visual-studio-code - 让空格看起来像 VS Code 中的选项卡

标签 visual-studio-code editorconfig

在 VS Code 中编写具有特定宽度(可能由 .editorconfig 文件确定)的空格样式的源文件时,如何强制 VS Code 将空格视为制表符而不重新格式化文件?

例如,缩进宽度可能是 4 个空格,因此我宁愿看到一个宽度为 4 个空格的制表符空格字符,而不是在编辑器中显示 4 个空格。

最佳答案

VSCode 1.52(2020 年 11 月)支持空格列表代码的选择方面,并且:

Sticky Tab Stops when indenting with Spaces

If you prefer to indent your code with spaces, there is a new setting called editor.stickyTabStops, which makes VS Code treat cursor movements in leading spaces similar to tabs.

Sticky Tab Stops -- https://media.githubusercontent.com/media/microsoft/vscode-docs/7bdaf30689a2352238048150da7087cc6857ca72/release-notes/images/1_52/sticky-tab-stops.gif

关于visual-studio-code - 让空格看起来像 VS Code 中的选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60386177/

相关文章:

visual-studio-code - 有没有办法让 VS Code 默认创建 HTML 文件?

.net - Visual Studio 2017代码样式“错误”不会阻止生成吗?

visual-studio-code - 从平台IO上传代码到esp32

c# - 在 Visual Studio 2022 中应用代码样式

visual-studio - XAML 文件 .editorconfig 规则

git - 在 Git 子模块中使用 editorconfig

linux - 找不到 editorconfig-core-c 的 Makefile

python - VScode扩展: CODE RUNNER and PYTHON PREVIEWER do not use the interpreter I select

c++ - vscode 智能感知不工作

c++ - Visual Studio Code - 远程调试 Bazel C++ - 无法读取文件'vscode-remote ://dev- file