简体   繁体   English

Visual Studio Code:单击空白行不尊重缩进

[英]Visual Studio Code: Clicking on blank line disrespects indentation

I want to start using VS code but this one issue is driving me insane.我想开始使用 VS 代码,但这个问题让我发疯了。

The normal behavior I am expecting is that when I am typing and pressing Enter at the end of a line, the new line is created and indented as expected, following the current scope's indentation:我期望的正常行为是,当我在行尾键入并按 Enter 时,将按照当前范围的缩进创建新行并按预期缩进:

在此处输入图像描述

My problem is, when I have inserted 2 newlines (pressed enter twice), or clicked on any empty line, the cursor always jumps back to the beginning and does not adhere to the indentation.我的问题是,当我插入 2 个换行符(按两次 Enter)或单击任何空行时,cursor 总是跳回到开头并且不遵守缩进。 In the image below I added a new line and then clicked on line 88 and the cursor automatically moved to the start of the line.在下图中,我添加了一个新行,然后单击第 88 行,cursor 自动移动到行首。

在此处输入图像描述

The only setting and suggestions I could find was to change the following setting: "editor.autoIndent": "full" .我能找到的唯一设置和建议是更改以下设置: "editor.autoIndent": "full" This however did nothing to help with this issue.然而,这对解决这个问题没有任何帮助。

The only extensions installed are C#, Razor/Blazor and Code Spell Checker.安装的唯一扩展是 C#、Razor/Blazor 和 Code Spell Checker。

Is there any other setting that can be set to fix this issue?是否可以设置任何其他设置来解决此问题?

VSCode automatically clears the indent of empty lines as you can see on the image below: VSCode 会自动清除空行的缩进,如下图所示:

在此处输入图像描述

There is an issue open on VSCode's GitHub (see #1 ), and requests for a Visual Studio-like solution for it (see #2 ), but it doesn't seem like something that will be implemented soon. VSCode 的 GitHub 存在一个问题(请参阅#1 ),并要求为其提供类似 Visual Studio 的解决方案(请参阅#2 ),但它似乎不会很快实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM