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

Blank EditorConfig still forces tab width to 4 and spaces to 2 #341

Open
2 tasks done
JustinGrote opened this issue Nov 26, 2022 · 3 comments
Open
2 tasks done

Blank EditorConfig still forces tab width to 4 and spaces to 2 #341

JustinGrote opened this issue Nov 26, 2022 · 3 comments

Comments

@JustinGrote
Copy link

JustinGrote commented Nov 26, 2022

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

If I have no editorconfig, and I have the following in my user settings.json

{
    "editor.tabSize": 2
}

then any tab-formatted file I open will reset the tab size to 4 and format using spaces
{7B916E4C-E615-4993-AEAB-782E12AEABB5}

If I disable the extension and reopen the file, it behaves as expected.
image

I've tried this with detect indentation on and off, no difference.

If I create a .editorconfig file with indent_size line, it now behaves as expected. So there appears to be an issue with a blank config where something gets initialized with a bad default value.

@STOWouters
Copy link

I encountered the same issue after the VSCode November 2022 update.

Downgrading VSCode back to the October 2022 version (1.73.1) fixed the issue. Apparently, there have been some changes in the indent and tab size settings in VSCode

Related issues:

@mazeneko
Copy link

mazeneko commented Dec 9, 2022

I have the same problem.

vscode has been updated to separate tabSize and indentSize,
but editorconfig-vscode applies the indent_size option in .editorconfig only to vscode's tabSize,
and indentSize is This seems to be due to the fact that it has not been changed.

In the actual code, only the tabSize is generated here,

return {
...(config.indent_style === 'tab' ||
config.indent_size === 'tab' ||
config.indent_style === 'space'
? {
insertSpaces: config.indent_style === 'space',
}
: {}),
tabSize:
resolved.tabSize && resolved.tabSize >= 0
? resolved.tabSize
: defaults.tabSize,
}

and the vscode setting is changed here.

editor.options = newOptions

Also, I added the indentSize property in the debugger on this line and run it, and it was set as expected.

However, there is no indentSize in the TextEditorOptions type to actually change the code.

@huyz
Copy link

huyz commented Apr 4, 2024

See #358 for WIP fix

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

4 participants