editorconfig-vscode icon indicating copy to clipboard operation
editorconfig-vscode copied to clipboard

It is non-obvious when editorconfig is overriding my chosen tab/indent settings

Open Pxtl opened this issue 2 years ago • 2 comments

Please fill-in this template.

  • [X] I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
  • [X] I tried running code --disable-extensions and the issue did NOT present itself.

Issue

Visual Studio Code editorconfig-vscode
Version 1.83.1 0.16.4

Root .editorconfig File

[*]
indent_style = space
indent_size = 4

Are there any other relevant .editorconfig files in your project? No

File opened

./example.ps1

Expected behavior

When I change my tab/indent settings in a file and editorconfig-vscode changes it back, there is some notice as to why this occurs.

Actual behavior

No notice that editorconfig-vscode is changing my file. This was confusing because the editorconfig was outside of the directory I had opened. That is, I had myProjectName\DevOps\PowershellModules open to edit all the child powershell modules.

There was an .editorconfig in myProjectName that I was unaware of. There is no visual indicator that an .editorconfig is undoing my changes, they just apparently change without notice, and there was no visible .editorconfig. I had assumed that tab autodetect was failing.

Additional comments or steps to reproduce

Create a directory with the following structure:

│   .editorconfig
│
└───src
        example1-tabs.ps1
        example2-spaces.ps1

where .editorconfig is

[*]
indent_style = space

and example1-tabs.ps1 is the same but with spaces.

# tabs
@foo = @(
	'bar',
	'baz',
	'quux'
)

and example2-spaces.ps1 is the same but with spaces.

Then open the src folder in vscode.

image

There is no visual indicator that an .editorconfig applies. If I manually switch example1-tabs.ps1 to indent using tabs, it will silently automatically switch back the moment I view another file and then return to example1-tabs.ps1.

This behavior is, of course, exactly what the editorconfig extension is supposed to do. But as a user who doesn't realize that the .editorconfig is present outside of the open directories, I have no way of knowing why this behavior is occurring. It is invisible. It took me a very long time to realize this is what was going on.

Pxtl avatar Nov 10 '23 17:11 Pxtl

(More elaborate) duplicate of #329.

Would love to see this, I just spent way too long fighting with my tab width... :)

HoldYourWaffle avatar Apr 13 '25 23:04 HoldYourWaffle

I'm fighting trying to figure out why vscode isn't honoring my .editorconfig file... vscode's status bar says "Spaces: 4".... but .editorconfig is set to 2 spaces....

bkdotcom avatar Apr 13 '25 23:04 bkdotcom