Search code examples
htmlcssvisual-studio-codeeditorconfig

EditorConfig extension for VS Code does nothing


I use VS Code as editor. We have a .editorconfig file with format configs within. We all use in our editors the extenion EditorConfig to format our HTML and CSS general. I have installed the extension EditorConfig for VS Code from here: https://github.com/editorconfig/editorconfig-vscode

Our .editorconfig file looks like this:

# This is the top-most .editorconfig file (do not search in parent directories)
root = true

### All files
[*]
# Force charset utf-8
charset = utf-8
# Indentation
indent_style = tab
indent_size = 4
# line breaks and whitespace
insert_final_newline = true
trim_trailing_whitespace = true
# end_of_line = lf

### Frontend files
[*.{css,scss,less,js,json,ts,sass,php,html,hbs,mustache,phtml,html.twig}]

### Markdown
[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

### YAML
[*.yml]
indent_style = space
indent_size = 2

### Specific files
[{package,bower}.json]
indent_style = space
indent_size = 2

I can't find any keyboard shortcut, setting or else. How to get my extension do the stuff from the .editorconfig file?


Solution

  • The problem I had was that I added the extension EditorConfig.EditorConfig to my VS Code, but didn't install the npm package for it. It's not enough to add the extension only to your VS Code, you have also to install the package, so it could run.

    I installed the npm package globally like this: npm install -g editorconfig

    After that I added the extension and enabled it. Now it works perfectly.

    Required npm package: https://www.npmjs.com/package/editorconfig

    Required VS Code extension: https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig