VSCode's language specific settings ignored
See original GitHub issuePlease fill-in this template.
- I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
- I tried running
code --disable-extensions
and the issue did NOT present itself.
Delete the following condition if it doesn’t apply to your case:
If the extension is not picking up the expected configuration for a file:
- I tried
npm install editorconfig -g
and raneditorconfig [file-in-question]
and the configuration was what I expected. If not, please file on theeditorconfig-core-js
issue tracker.
Running this just gave me nothing, as to be expected because there is no .editorconfig
. However it does seem to find some configuration, whether from settings or from weird defaults, I don’t know.
Issue
Visual Studio Code | editorconfig-vscode | |
---|---|---|
Version | 1.36.1 |
0.13.0 |
Root .editorconfig
File
Nonexistent
Are there any other relevant .editorconfig
files in your project? No
Visual Studio Code Setting | Default | User | Javascript |
---|---|---|---|
editor.insertSpaces |
true |
true |
true |
editor.tabSize |
4 |
4 |
2 |
editor.trimAutoWhitespace |
true |
true |
true |
files.autoSave |
"off" |
"on" |
"on" |
files.insertFinalNewline |
false |
true |
true |
files.trimTrailingWhitespace |
false |
true |
true |
The relevant setting I’ve run into is editor.tabSize
.
File opened
Any
Expected behavior
indent_size = 2
Actual behavior
indent_size = 4
Additional comments or steps to reproduce
It’ll give output like:
[currentfile]: {"tabSize":4}
This leads me to believe the settings ignore language specific settings. I do not think that this is intended, sorry if that assumption is incorrect. This happens most minimally with the following settings:
{
"[javascript]": { // Or javascriptreact and whatever else I tested.
"editor.tabSize": 2,
},
"editor.tabSize": 4,
//"editor.detectIndentation": false, # Ultimately not relevant.
}
This is especially odd to me because no .editorconfig
file is required, or even an empty editor config file with root=true
to prevent traversing up further. I would think that the extension should be no-op in a scenario like this, but it does not appear to be.
Here is a recording of an example scenario, switching from a markdown file to a .js
(react file type) file with these settings:
(sorry if the quality isn’t good)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top GitHub Comments
I published a fix in v0.14.1, so let me know if the issue still presents itself.
Thanks for the thorough report! I am contractually unable to submit PRs to open source projects, so someone else will have to fix it.