Indent/Outdent with tab key does not honor editor.autoIndent=false
See original GitHub issueIssue Type: Bug
When I have:
/*
* Comment
*/
If I select it and hit tab, I get:
/*
* Comment
*/
If instead I had hit shift-tab, I get:
/*
* Comment
*/
Same happens with Ctrl-]
and Ctrl-[
(if those are supposed to make a difference)
I hoped turning off autoIndent would stop this, but no dice. I also turned off C++ formatting in the JSON config:
{
"editor.autoIndent": false,
"editor.detectIndentation": false,
"C_Cpp.formatting": "Disabled"
}
I have done due diligence by asking (and bountying, +100) a question on StackOverflow to get an answer on what to do about this, but no one seems to know:
https://stackoverflow.com/q/53326134/preserve-spacing-on-indent-or-outdent-with-tab-in-vscode
If someone can provide a resolution here, be sure to go there and get the bounty points.
VS Code version: Code 1.29.1 (bc24f98b5f70467bc689abf41cc5550ca637088e, 2018-11-15T19:13:36.375Z) OS version: Windows_NT x64 10.0.17134
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-7700HQ CPU @ 2.80GHz (8 x 2808) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: enabled video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled |
Memory (System) | 15.86GB (1.40GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
Extensions (3)
Extension | Author (truncated) | Version |
---|---|---|
vscode-github | Kni | 0.30.0 |
python | ms- | 2018.10.1 |
cpptools | ms- | 0.20.1 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:5 (2 by maintainers)
Top GitHub Comments
Guys Any update on this? I’m having the same issue!
This issue also affects indentation of XML severely. For example, with indentation set at 4 spaces, starting with this text:
increasing indentation by one step using the “Indent Line” command produces this:
Starting with this text
and decreasing indentation by one step using the “Outdent Line” command produces this:
This style of indentation may feel strange to some people, but that’s part of the whole issue — who are people, and who is VSCode, to tell others how to format their code? If I wanted my text editor to mangle my formatting, I would opt in to automated formatting.
Increasing and decreasing indentation should be a simple operation of adding or removing one fixed string (in my example, a string consisting of four spaces) to/from the beginning of each line. Yes, there are some important edge cases to take care of (e.g. what happens when one of the selected lines doesn’t have enough whitespace to take away on an outdent; or e.g. ignoring the last empty line of a block of lines selection), but VSCode gets them right already (and most plugins that implement things naively do not). Why confound the simple, deterministic operation of changing the indentation level with something as complex (and often buggy, which is why people turn it off) automatic formatting?
If changing the default behaviour of these actions is somehow controversial, can you at least provide “Indent Line Trivially” and “Outdent Line Trivially” pair of actions that people who don’t want their code mangled can use?