你可以如何在VS Code工作区中循环遍历所有源代码控制更改?

huangapple go评论68阅读模式
英文:

How can I cycle through all source control changes in a VS Code workspace?

问题

在VS Code中,在单个文件编辑器选项卡中,有命令可以遍历文件中的更改:下一更改上一更改。但如何在工作区中遍历所有文件而不是单个文件?或者更好的方法是如何在工作区中遍历所有已更改的文件?

我在"键盘快捷键"面板中搜索了这些命令,但没有找到。

英文:

In VS Code, in a single file editor tab, there are commands to iterate thru changes in a file: Next Change and Previous Change. But how can I cycle through all changes across all the files in a workspace instead of a single file? Or maybe even better, how can I cycle through all the changed files in a workspace?

I searched such commands in the "keyboard shortcut" panel to no avail.

答案1

得分: 2

你可以打开源代码控制视图,然后只需点击更改列表。如果你想使用键盘,你可以通过按下<kbd>ctrl/cmd</kbd>+<kbd>0</kbd>来聚焦视图(主要边栏),然后使用上下箭头键导航列表项,并通过按<kbd>enter</kbd>键来打开聚焦列表项的差异。


通过搜索“github vscode issues keyboard shortcut next scm file”,我认为你可能会对以下功能请求问题感兴趣:

请给这些问题票点赞以表示支持,并订阅它们以获取关于讨论和进展的通知。请避免发表类似“+1” / “顶” / “我也是”的嘈杂评论。

有人在那里列出了一个解决方法,使用了geddski宏扩展,你可能会对此感兴趣。这种解决方法仅支持循环浏览文件,而不支持文件中的更改,并且在浏览它们时不会自动关闭文件。它还要求您最近在SCM视图的更改列表中选择了一个项目,以便列表有一种焦点。实际上,使用runCommands就不需要那个宏扩展。你应该能够像这样实现相同的功能:

{
    "key": "", // TODO
    "command": "runCommands",
    "args": {
        "commands": ["workbench.view.scm", "list.focusDown", "list.select"]
    }
},
{
    "key": "", // TODO
    "command": "runCommands",
    "args": {
        "commands": ["workbench.view.scm", "list.focusUp", "list.select"]
    }
},

请注意,如果你使用GitHub Pull Requests扩展,该扩展有一个名为“Go to Next Diff in Pull Request”的命令()。

英文:

You could open the Source Control View and just click through the list of Changes. If you want to use the keyboard, you can focus the View (primary sidebar) using <kbd>ctrl/cmd</kbd>+<kbd>0</kbd>, and navigate the list items using the up and down arrow keys, and open a diff for the focused list item by pressing <kbd>enter</kbd>.


From googling "github vscode issues keyboard shortcut next scm file", I think you'll be interested in the following feature-request issue tickets:

Give those issue tickets thumbs up reactions to show support for them, and subscribe to them to get notified about discussion and progress. Please avoid making noisy comments like "+1" / "bump" / "me too".

Someone listed a workaround there using the geddski macros extension, which you may be interested to see. The workaround only supports cycling through files and not changes in those files, and doesn't automatically close the files when cycling through them. It also requires that you have selected an item in the SCM View's change listing recently so that the list has a sort of focus. Actually, that macros extension shouldn't be needed with runCommands. You should be able to achieve the same thing like this:

{
    &quot;key&quot;: &quot;&quot;, // TODO
    &quot;command&quot;: &quot;runCommands&quot;,
    &quot;args&quot;: {
        &quot;commands&quot;: [&quot;workbench.view.scm&quot;, &quot;list.focusDown&quot;, &quot;list.select&quot;]
    }
},
{
    &quot;key&quot;: &quot;&quot;, // TODO
    &quot;command&quot;: &quot;runCommands&quot;,
    &quot;args&quot;: {
        &quot;commands&quot;: [&quot;workbench.view.scm&quot;, &quot;list.focusUp&quot;, &quot;list.select&quot;]
    }
},

Note that if you're using the GitHub Pull Requests extension, that extension has a command called Go to Next Diff in Pull Request (source).

huangapple
  • 本文由 发表于 2023年6月15日 19:02:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76481818.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定