[英]How can I recursively unindent code in Visual Studio Code?
I have a block of code that has one too many indentations on every nested block in Visual Studio Code, two tabs(four spaces) per nested block.我有一段代码,在 Visual Studio Code 中的每个嵌套块上都有一个太多的缩进,每个嵌套块有两个制表符(四个空格)。 I want one tab(two spaces) per nested block.
我想要每个嵌套块一个选项卡(两个空格)。 I can unindent a block with shift + tab , but if I unindent further, the nesting structure will not be preserved.
我可以使用shift + tab取消缩进一个块,但是如果我进一步取消缩进,嵌套结构将不会被保留。
Is there a command in VS Code to recursively unindent an entire file or selection without having to manually remove each unwanted indentation(ie one tab from the first block, two tabs from the second block, etc.)? VS Code 中是否有一个命令可以递归地取消缩进整个文件或选择,而无需手动删除每个不需要的缩进(即第一个块中的一个选项卡,第二个块中的两个选项卡等)? I wish to only change the indentation, so I cannot use automatic formatting which will make other changes like Prettier.
我希望只更改缩进,所以我不能使用自动格式化,这会像 Prettier 这样进行其他更改。
<div class="grid-container">
<div class="grid-item">
<a href="https://www.goodreads.com/book/show/17255186-the-phoenix-project" target="_blank">
<img src="https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1361113128l/17255186.jpg">
</a>
</div>
</div>
If only part of the file needs unindent如果只有部分文件需要取消缩进
Multi Cursor method works for up to 10000 indents.多 Cursor 方法最多可用于 10000 个缩进。 If needed repeat for the next section in the file.
如果需要,请重复文件中的下一部分。
Or with Find/Replace或使用查找/替换
Replace All
in the Find dialogReplace All
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.