question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode's language specific settings ignored

See original GitHub issue

Please 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 ran editorconfig [file-in-question] and the configuration was what I expected. If not, please file on the editorconfig-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:

Spaces abruptly changing from 2 to 4 in a Javascript react file.

(sorry if the quality isn’t good)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jednanocommented, Oct 10, 2019

I published a fix in v0.14.1, so let me know if the issue still presents itself.

0reactions
jednanocommented, Jan 5, 2020

Thanks for the thorough report! I am contractually unable to submit PRs to open source projects, so someone else will have to fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

User and Workspace Settings - Visual Studio Code
Another way to customize your editor by language is by running the global command Preferences: Configure Language Specific Settings (command ID: workbench.
Read more >
Visual Studio Code: ignore language specific setting on sync
I want to exclude a language specific setting in Visual Code from syncing. I already have excluded a non-specific setting, ...
Read more >
Support file-type-specific settings #1587 - microsoft/vscode
I call it editor. · I introduce an extra settings node to be able to distinguish the actual context the setting applies to...
Read more >
User and Workspace Settings - vscode-docs
It's easy to configure VS Code the way you want by editing the various setting files where you will find a great number...
Read more >
, the Go language server
Configuration. Ignored settings; gopls settings block ... Configuration. There are a number of VS Code Go settings for controlling the language server.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found