The below settings are recommended to help you follow our other guidelines.
These are the minimum extensions we recommend you have installed.
Canvas projects can automatically install these extensions in VS Code.
These links will open the Visual Studio Marketplace.
- Code Spell Checker
- ESLint
- GraphQL
- GraphQL Syntax
- Highlight Matching Tag
- Import Cost
- Shopify Liquid (disable Theme check, see below)
- stylelint
- Volar
- YAML
We do not recommend the Prettier extension as it's too opinionated.
Useful settings to make your life easier.
Canvas projects can automatically apply these settings in VS Code.
- Press
cmd
+,
(ctrl
+,
on Windows) to open the settings dialog in VS Code - Click the arrow pointing to the page icon in top right
- Paste settings below into the JSON format file this has opened
- Bracket colourisation
- Character limit
- Diff whitespace
- Disable file preview
- Disable theme check
- End of line character
- File associations
- Git autofetch
- HTML validation
- Lint on save
- Tab size
- Trim trailing whitespace
"editor.bracketPairColorization.enabled": true
- VS Code natively supports bracket colourisation so you no longer need the extension
"editor.rulers": [
80
],
"workbench.colorCustomizations": {
"editorRuler.foreground": "#ffffff33"
}
- Adds a vertical border in your code editor denoting where the 80 character limit is
editorRuler.foreground
sets the colour of the ruler using alpha-hexadecimal values
"diffEditor.ignoreTrimWhitespace": false
- Don't ignore whitespace in the diff view of VS Code
- See trim trailing whitespace so you don't have to manually remove trailing whitespace
"workbench.editor.enablePreviewFromQuickOpen": false
- When opening files from
cmd
+p
(orctrl
+p
on Windows) file search they won't open in preview mode - This means that opening another file won't close the previous one
"shopifyLiquid.disableWindowsWarning": true,
"shopifyLiquid.formatterDevPreview": false,
"themeCheck.checkOnChange": false,
"themeCheck.checkOnOpen": false,
"themeCheck.checkOnSave": false,
"themeCheck.onlySingleFileChecks": true,
"workbench.editor.enablePreviewFromQuickOpen": false
- We use the Shopify Liquid extension to add syntax highlight and autocomplete, however it also comes with Theme Check which does not support Canvas
- These settings disable theme check
"files.eol": "\n"
- Prevents issues with end of line characters being different
"files.associations": {
"*.scss.liquid": "scss",
"*.js.liquid": "javascript"
}
- This tells VS Code to ignore the
.liquid
extension and open the files with the write sort of highlighting enabled
"git.autofetch": true
- Autofetches the Git repo every five minutes
"html.validate.scripts": false,
"html.validate.styles": false
- Stops validating
<script>
and<style>
tags in HTML files - These are frequently used to pass Liquid variables into global JS
- Because of the presence of Liquid in these tags VS Code's linter flags errors
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
},
"stylelint.validate": ["css", "scss"]
- Runs
eslint --fix
andstylelint --fix
on file save formatOnSave
is set tofalse
to prevent Prettier extension from running (if installed)- Sets Stylelint extension to validate SCSS files as well as CSS files
"editor.tabSize": 2
- You should use a tab size of two spaces to follow guidelines
"files.trimTrailingWhitespace": true
- Trims any trailing whitespace on file save (makes linting happy)