Skip to content

(Ruby) autoindentation changes when opening settings.json (!) #136708

@64kramsystem

Description

@64kramsystem

Issue Type: Bug

This is a very weird bug, but I can reproduce it 100% of the times, with extensions disabled. I've tested it also on the release VSC version.

  • install and start VSC (1.63.0-insider) with extensions disabled
  • create a Ruby file with the following content:
def mytest
  foo
    .bar
# comment
  baz
end
  • open settings.json via command (Ctrl + Shift + P; the file should have no settings), and add the following setting:
  "[ruby]": {
    "editor.autoIndent": "advanced",
  }
  • close settings.json (important!)
  • close VSC
  • open VSC again; the Ruby file will be automatically opened
  • go to the beginning of the # comment line, and tap Enter
  • a newline will be inserted, and # comment will keep the same indentation; I assume that this is the behavior of the "advanced" ruby autoindentation
  • open settings.json
  • switch back to the Ruby file
  • go to the beginning of the # comment line, and tap Enter
  • a newline will be inserted, but # comment will now be automatically indented (4 spaces to the right); I assume that this is the behavior of the "full" ruby autoindentation
  • if settings.json is now closed, the autoindentation still (incorrectly) behaves as "full"

In short, the act of opening settings.json (without changing anything) affects how (Ruby) autoindentation works, which seems a bug to me.

VS Code version: Code - Insiders 1.63.0-insider (a7104f1, 2021-11-08T06:09:14.810Z)
OS version: Linux x64 5.11.0-38-generic
Restricted Mode: Yes

Extensions disabled

Details

A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
pythontb:30258533
vsc_aa:30263845
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805cf:30301675
pythonvspyt200:30323110
vsccppwt:30382699
bridge0708:30335490
pygetstartedt2:30353727
bridge0723:30353136
pythonrunftest32:30365365
pythonf5test824:30361779
javagetstartedt:30350119
pythonvspyt187:30365360
pydsgst2:30361790
vsaa593cf:30376535
vsc1dsc:30394499

Metadata

Metadata

Assignees

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