Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
Pxtl opened this issue Nov 10, 2023 · 0 comments
Open
2 tasks done

Comments

@Pxtl
Copy link

Pxtl commented Nov 10, 2023

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant