Skip to content

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

@Pxtl

Description

@Pxtl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions