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

Preferences/Settings/"Tab Size" option and "Insert Spaces" option not working as expected #172171

Closed
vcrobe opened this issue Jan 24, 2023 · 2 comments
Assignees
Labels
settings-editor VS Code settings editor issues under-discussion Issue is under discussion for relevance, priority, approach
Milestone

Comments

@vcrobe
Copy link

vcrobe commented Jan 24, 2023

Type: Bug

Steps to reproduce

1- Install VSCode (portable version)
2- Install C# for VS Code extension
3- Create a C# console app using the CLI
4- Open the project folder in VSCode
5- Go to File/Preferences/Settings
6- In the "User" settings set:
a) Editor: Tab Size to 3
b) Editor: Render Whitespace to "all"
c) Editor: Insert Spaces to "false" (unchecked)
d) Editor: Detect Indentation to "false" (unchecked)

7- In the "Workspace" settings set:
a) Editor: Tab Size to 4
b) Editor: Render Whitespace to "selection" (default)
c) Editor: Insert Spaces to "true" (checked) (default)
d) Editor: Detect Indentation to "false" (unchecked)

When I close the the settings this is what is stored in the settings.json file

{
	"editor.detectIndentation": false
}

It's storing only the non default values so when I press tab the tab size is 3 and it's not inserting spaces!

And the whitespaces are all rendered all the time. In this case they must be rendered only when a selection is made!

Solution

When creating/modifying the settings.json VSCode must analyze the hierarchy of settings (Folder, Workspace, User) to determine what values must be stored in the file.

Currently I'm working on a solution with four projects. Two of them use whitespaces the others use tabs. I had to switch to Visual Studio because it's using the User settings instead the folder settings. So all files of all projects are stored using spaces in all cases.

VS Code version: Code 1.74.3 (97dec17, 2023-01-09T16:59:02.252Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz (8 x 2395)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: unavailable_off
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: unavailable_off
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.95GB (11.94GB free)
Process Argv --crash-reporter-id 56c2c980-cc45-4989-bfa8-01a52976173f
Screen Reader no
VM 0%
Extensions (1)
Extension Author (truncated) Version
csharp ms- 1.25.2
@rzhao271 rzhao271 added bug Issue identified by VS Code Team member as probable bug settings-editor VS Code settings editor issues under-discussion Issue is under discussion for relevance, priority, approach and removed bug Issue identified by VS Code Team member as probable bug labels Jan 24, 2023
@rzhao271 rzhao271 added this to the February 2023 milestone Jan 24, 2023
@rzhao271 rzhao271 modified the milestones: February 2023, March 2023 Feb 21, 2023
@rzhao271
Copy link
Contributor

A workaround for now is manually editing the workspace JSON setting files.
Adjusting the workspace setting away from the default value and back to the default value again should also save the setting into the workspace JSON setting file.

Potential duplicate of #58038

@rzhao271 rzhao271 modified the milestones: March 2023, April 2023 Mar 21, 2023
@rzhao271 rzhao271 modified the milestones: April 2023, May 2023 Apr 21, 2023
@rzhao271
Copy link
Contributor

Closing as a duplicate of #58038

@rzhao271 rzhao271 closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
settings-editor VS Code settings editor issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

2 participants