英文:
How can I copy a highlighted semantic symbol occurrence wrapped in quotes to the clipboard in VS Code?
问题
I understand your request. Here's the translated part:
在使用VS Code编辑XML文档时,例如,当我点击引号内部,比如
<section xml:id="agama-automated-installation-profile">
VS Code会为我高亮显示agama-automated-installation-profile
字符串,但鼠标光标不会将其高亮显示为选择,因此无法使用CTRL+C复制它。
是否有一种简便的方式将这个片段复制到剪贴板上?
CTRL+C对于这个片段不起作用,因为实际选择是空的,因此整行都被复制了。
英文:
When editing an XML document in VS Code and after I click, for example, inside the quotes of
<section xml:id="agama-automated-installation-profile">
VSCode highlights the agama-automated-installation-profile
string for me but it is not highlighted as a selection by mouse cursor therefore i cannot copy it by CTRL+C
Is there a shortcut to copy the snippet to the clipboard easily?
CTRL+C just does not work for this snippet because the real selection is empty and thus the whole line is copied.
答案1
得分: 0
你可以要么按下<kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>Right</kbd>(命令Expand Selection
)两次来选择所有内容,然后复制它,要么创建一个宏来在一步内执行它(使用内置命令runCommands
):
{
"key": "alt+g", // 你想要的任何快捷键
"command": "runCommands",
"args": {
"commands": [
"editor.action.smartSelect.expand",
"editor.action.smartSelect.expand",
"editor.action.clipboardCopyAction",
"cancelSelection"
]
}
}
英文:
You could either hit <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>Right</kbd> (the command Expand Selection
) twice to select it all and then copy it, or create a macro to do it in one step (with the built-in command runCommands
):
{
"key": "alt+g", // whatever keybinding you want
"command": "runCommands",
"args": {
"commands": [
"editor.action.smartSelect.expand",
"editor.action.smartSelect.expand",
"editor.action.clipboardCopyAction",
"cancelSelection"
]
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论