microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.44k stars 29.35k forks source link

Indentation will not stick to default value OR set value #121123

Closed skamansam closed 3 years ago

skamansam commented 3 years ago

Issue Type: Bug

  1. Set indentation to 2 spaces.
  2. Switch to another application.
  3. Switch back to VSCode Insiders.

Expected results: the indentaion setting has not changed.

Actual Results: the tab indentation has switched to "Spaces: 4." The default setting is "Spaces: 2."

VS Code version: Code - Insiders 1.56.0-insider (01466cf692c3e54f0eeb82ef0539a42391f185de, 2021-04-12T05:16:52.719Z) OS version: Linux x64 5.11.11-200.fc33.x86_64

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2200)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|2, 2, 1| |Memory (System)|15.49GB (1.14GB free)| |Process Argv|--no-sandbox --unity-launch --crash-reporter-id 02322043-412c-4372-a6fb-f9a7b5e9e83f| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|gnome-xorg| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome-xorg| |XDG_SESSION_TYPE|x11|
Extensions (49) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|2.1.0 Bookmarks|ale|13.0.4 vue-jsdoc|bej|0.0.2 color-info|bie|0.5.1 better-toml|bun|0.3.2 bracket-pair-colorizer-2|Coe|0.2.0 elasticdeveloper|cra|1.2.15 package-json-helper|Dan|0.0.1 vue-peek|dar|1.0.2 vscode-eslint|dba|2.1.19 gitlens|eam|11.4.0 EditorConfig|Edi|0.16.4 vsc-material-theme|Equ|33.2.0 vsc-material-theme-icons|equ|1.2.2 prettier-vscode|esb|6.3.2 auto-close-tag|for|0.5.10 auto-rename-tag|for|0.1.6 vscode-pull-request-github|Git|0.25.0 vscode-test-explorer|hbe|2.19.6 rest-client|hum|0.24.5 vscode-typescript-jsdoctag-completions|jef|1.0.2 vscode-insertdatestring|jsy|2.3.0 vscode-jest-test-adapter|kav|0.8.0 vscode-codemetrics|kis|1.24.0 better-package-json|ldd|0.1.0 javascript-test-runner|leg|1.0.0 i18n-ally|lok|2.5.5 materialdesignicons-intellisense|luk|3.2.0 code-beautifier|mic|2.3.3 jupyter|ms-|2021.6.740555125 javascript-test-runner|nil|0.2.0 vetur|oct|0.33.1 indent-rainbow|ode|7.5.0 vuetify2-jest-snippets|pra|0.0.2 redshred-pack|red|0.0.1 elastic|ria|0.13.3 color-manager|roy|0.6.2 vscode-jest-test-adapter|rtb|0.2.0 vue-vscode-snippets|sdr|2.2.0 markdown-preview-enhanced|shd|0.5.17 addDocComments|ste|0.0.8 rewrap|stk|1.14.0 rainbow-tags|vol|0.3.2 vuetify-vscode|vue|0.2.0 vscode-import-cost|wix|2.15.0 vue|Wsc|1.0.26 fontforge-vscode|xia|0.0.2 html-css-class-completion|Zig|1.20.0 grammarly|znc|0.14.0 (8 theme extensions excluded)
vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

skamansam commented 3 years ago

This appears to only happen with CSS/SCSS/SASS files.

Morilli commented 3 years ago

I'm having a similar issue, and it is really frustrating. I am working on a project with many files, some use tab indentation and some use spaces. Automatic detection doesn't work, and every time vscode loses focus the indentation setting is changed to indent using tabs instead of 4 spaces like I want, and there is no way to make it stay that way.

It is and has been messing up my commits multiple times now, and each time I wondered how I was writing tabs in a file with space-only indentation. This has never happened before, so it has probably been a recent change.

Morilli commented 3 years ago

Alright, I've figured out the issue. This happens due to the editorconfig extension, which searches outside of the currently opened folder for any .editorconfig file and applies this to the current project. While this is a tremendous issue in my opinion, it seems to not be caused by vscode in any way, just the extension itsef.

@skamansam you might be able to confirm if you're still having this issue.

rebornix commented 3 years ago

As @Morilli helped above, it was caused by editor config extension. Closing it now and we can reopen if @skamansam is seeing different symptons (e.g., no editor config extension/config)