Technical Blog of Francis Setash

ChefDK - Visual Studio Code Support

Posted on — Jan 29, 2017

Super quick post, but one I wanted to throw down - here’s how to get Visual Studio Code working for the ChefDK in Windows; and I’ll also share my Visual Studio Code preferences file!

So, this should hold true for using VS Code as a native/default editor for Git and any other application with a like workflow.


current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "myWorkstationNode"
client_key               "#{current_dir}/username.pem"
validation_client_name   "org-validator"
validation_key           "#{current_dir}/org-validator.pem"
chef_server_url          "https:/mychefserver/organizations/ipy"
syntax_check_cache_path  "#{ENV['HOME']}/.chef/syntaxcache"
cookbook_path            ["#{current_dir}/../cookbooks"]
knife[:editor] = '"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe" --wait'

The last line is what needs to be noted;

And then, becuase I’ve been working with VS Code a while; here is my Visual Studio Code User Preferences that I think others may like:

    "editor.cursorStyle": "block",
    "": "c:\\windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.scrollback": 3000,
    "editor.renderWhitespace": "boundary",
    "editor.renderIndentGuides": true,

Let’s see here:

Really not a ton that needs to be tweaked, but I find these minimal options make the editor MUCH more pleasant for me to use.