Skip to content

Latest commit

 

History

History
57 lines (48 loc) · 2.35 KB

File metadata and controls

57 lines (48 loc) · 2.35 KB

VSCode instructions

How it works?

Here is a VSCode setup integration example VSCode

Install VSCode

  1. Install VS code binary. Here is the download link for Windows, macOS, linux-debian.
  2. Start VSCode, on macOS press CMD+<SPACE> and type code
  3. Install YAML support for VSCode. Here is the github repo

JSON/YAML Setup

  1. Edit "user.settings" on macOS Code -> Preferences -> Settings
  2. In the search bar search for json.schemas VS-Code-Setup
  3. Click on settings.json
  4. Cut-n-paste the following settings (note this is setup for US-east-1 currently, the same
{
    "[yaml]": {
        "editor.insertSpaces": true,
        "editor.tabSize": 2,
        "editor.quickSuggestions": {
            "other": true,
            "comments": false,
            "strings": true
        },
        "editor.autoIndent": true
    },
    "editor.renderWhitespace": "all",
    "editor.tabSize": 2,
    "editor.autoIndent": true,
    "yaml.format.enable": true,
    "yaml.trace.server": "verbose",
    "json.schemas": [
        {
            "fileMatch": [
                "*-cfn-us-east-1.json"
            ],
            "url": "https://s3.us-east-1.amazonaws.com/cfn-resource-specifications-us-east-1-prod/schemas/2.15.0/all-spec.json"
        }
    ],
    "yaml.schemas": {
        "https://s3.amazonaws.com/cfn-resource-specifications-us-east-1-prod/schemas/2.15.0/all-spec.json": "*-us-east-1-cfn.yaml"
    }
}
  1. Create new file with the extension specified in the mapping network-cfn-us-east-1.json, or network-cfn-us-east-1.yaml. VSCode will use the mapping to determine code assist, validate the template locally for errors

YAML Gotchas

YAML is very whitespace sensitive for code completion. YAML LSP support does not deal with whitespace correctly. Here are tips to follow along if code completion isn't working as desired

  1. Ensure to get rid of all white spaces below the line you are editing
  2. Remember that you can not edit in between. Editing towards the end is the only one works. You still will have some partial results but experience is subpar. This is true for all json schemas