From 4a1c12dcfe3c744a061e29ee0c9596bd3020613f Mon Sep 17 00:00:00 2001 From: Anders Swanson Date: Thu, 18 Aug 2022 15:52:53 +0000 Subject: [PATCH] YAML autocomplete --- .devcontainer.json | 24 ++++++++++++++++++++++-- .vscode/extensions.json | 3 ++- README.md | 6 ++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.devcontainer.json b/.devcontainer.json index e6824b6fb..faef12f36 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -57,7 +57,26 @@ "workbench.editor.revealIfOpen": true, "editor.rulers": [ 99 - ] + ], + "yaml.schemas": { + "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_yml_files.json": [ + "/*.yml", + "!profiles.yml", + "!dbt_project.yml", + "!packages.yml", + "!selectors.yml", + "!profile_template.yml" + ], + "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_project.json": [ + "dbt_project.yml" + ], + "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/selectors.json": [ + "selectors.yml" + ], + "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/packages.json": [ + "packages.yml" + ] + } }, "extensions": [ "bastienboutonnet.vscode-dbt", @@ -67,7 +86,8 @@ "ms-azuretools.vscode-docker", "ms-python.python", "visualstudioexptteam.vscodeintellicode", - "samuelcolvin.jinjahtml" + "samuelcolvin.jinjahtml", + "redhat.vscode-yaml" ], "remoteUser": "vscode" diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 9a44b9dd2..2d4ec01c5 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,7 +6,8 @@ "recommendations": [ "innoverio.vscode-dbt-power-user", "mechatroner.rainbow-csv", - "yzhang.markdown-all-in-one" + "yzhang.markdown-all-in-one", + "redhat.vscode-yaml" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [ diff --git a/README.md b/README.md index 3d939a300..472cb4cae 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,12 @@ There's some bells and whistles defined in the [.devcontainer.json]().devcontain 4. the `find-related` extension allows an easy shortcut to navigating using `CMD`+`R`to jump from - a model file to it's corresponding compiled version, - from a compiled file to either the original model file or the version in `target/run` +5. The `vscode-yaml` YAML, combined with the JSON schema defined in [dbt-labs/dbt-jsonschema](https://github.com/dbt-labs/dbt-jsonschema), autocomplete options while working with dbt's YAML files: i.e. : + - Project definition files (`dbt_project.yml`) + - Package files (`packages.yml`) + - Selectors files (`selectors.yml`) + - Property files (`models/whatever.yml`) +