使选定的文本块大写 [英] Make selected block of text uppercase
问题描述
我可以在 Visual Studio Code 中多行选择所有大写的文本吗?
在完整的 Visual Studio 中,它是 CTRL+SHIFT+U 来做到这一点.
我见过的存在的扩展只用于非多行块.
注意:在问这个问题时(5 年或更早),VISUAL STUDIO 代码的用户界面已经改变.
问题是关于如何使CTRL+SHIFT+U在 Visual Studio Code 中工作.这是如何做到的.(版本 1.57.1 或更高版本).
步骤
打开 Visual Studio 代码
按CTRL+SHIFT+P
类型
打开键盘快捷键
选择
<块引用>打开键盘快捷键(json)
一个带有 keybindings.json 文件的编辑器将会出现.将以下 JSON 放入其中并保存.
<预><代码>[{键":ctrl+shift+u",命令":editor.action.transformToUppercase",何时":editorTextFocus"},{键":ctrl+shift+l",命令":editor.action.transformToLowercase",何时":editorTextFocus"}]现在 CTRL+SHIFT+U 将大写所选文本,即使是多行.同理,CTRL+SHIFT+L 将使选中的文本小写.
这些命令内置于 VS Code 中,无需扩展即可使其工作.
2021 年 8 月更新有一个用户界面可以查看和更新键盘快捷键.
文件->首选项 ->键盘快捷键.
找到转换为大写"
点击 + 图标
在弹出窗口中,按所需的组合键并按 Enter
对小写也做同样的事情.
注意: 在 VSC 的新版本(例如 1.57.x)中,Ctrl+Shift+L 是批量选择所有选定文本出现的快捷方式.(你可以使用另一个,比如 Ctrl+Shift+/)
Can I make a multi-line selection of text all capitals in Visual Studio Code?
In full Visual Studio it's CTRL+SHIFT+U to do this.
The extension that exists that I have seen only do non-multi-line blocks.
NOTE: THE UI OF VISUAL STUDIO CODE WHEN THIS QUESTION WAS ASKED (5 OR MORE YEARS AGO) HAS CHANGED.
The question is about how to make CTRL+SHIFT+U work in Visual Studio Code. Here is how to do it. (Version 1.57.1 or above).
Steps
Open Visual Studio Code
Press CTRL+SHIFT+P
Type
open keyboard shortcuts
Select
Open keyboard shortcuts (json)
An editor will appear with keybindings.json file. Place the following JSON in there and save.
[
{
"key": "ctrl+shift+u",
"command": "editor.action.transformToUppercase",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l",
"command": "editor.action.transformToLowercase",
"when": "editorTextFocus"
}
]
Now CTRL+SHIFT+U will capitalise selected text, even if multi line. In the same way, CTRL+SHIFT+L will make selected text lowercase.
These commands are built into VS Code, and no extensions are required to make them work.
Update August 2021 There is a UI to see and update keyboard shortcuts.
File-> Preferences -> Keyboard Shortcuts.
Find "Transform to Uppercase"
Click the + icon
In the popup, press the desired key combination and hit enter
Do the same for lower case.
Note: In the new versions (eg 1.57.x) of VSC, Ctrl+Shift+L is a shortcut for bulk selecting all selected text occurrences. (You can use another, like Ctrl+Shift+/)
这篇关于使选定的文本块大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!