vscode键绑定"转到搜索结果窗格上的下一个搜索结果"?

bni*_*and 31 visual-studio-code

是否有"在搜索结果窗格中转到下一个搜索结果"的vscode键绑定?

我无法在keybindings json或http://code.visualstudio.com/docs/customization/keybindings中找到它,但描述并不总是那么好,我可能错过了它!

Rhy*_*den 45

现在支持此功能.

  • F4 下一个搜索结果
  • Shift+ F4以前的搜索结果

  • 虽然这有效,但它有一些奇怪的行为:如果删除包含搜索结果的一行代码,则该结果周围的"选择框"消失,当您按F4时,它会再次从顶部搜索结果开始.如果由于代码编辑导致搜索结果消失,它会自动聚焦下一个搜索结果,这将是很好的. (5认同)
  • 是的,这绝对令人发疯。 (3认同)
  • @void.pointer 这是一个 GitHub 问题,跟踪修复了搜索位置被遗忘的问题,如果有人编辑任何内容:https://github.com/Microsoft/vscode/issues/20467(截至 2018 年 11 月,状态为`待办事项,已准备就绪`:- / ) (3认同)

joe*_*dle 9

如果您打算将 F4 和 Shift-F4 重新绑定到不同的键,请注意有多个操作绑定到这些键:

{ "key": "f4",         "command": "goToNextReferenceFromEmbeddedEditor",       "when": "inReferenceSearchEditor"  },
{ "key": "shift+f4",   "command": "goToPreviousReferenceFromEmbeddedEditor",   "when": "inReferenceSearchEditor"  },
{ "key": "f4",         "command": "search.action.focusNextSearchResult",       "when": "hasSearchResult"          },
{ "key": "shift+f4",   "command": "search.action.focusPreviousSearchResult",   "when": "hasSearchResult"          },
{ "key": "f4",         "command": "goToNextReference",                         "when": "referenceSearchVisible"   },
{ "key": "shift+f4",   "command": "goToPreviousReference",                     "when": "referenceSearchVisible"   },
{ "key": "f4",         "command": "references-view.next",                      "when": "reference-list.hasResult" },
{ "key": "shift+f4",   "command": "references-view.prev",                      "when": "reference-list.hasResult" },
Run Code Online (Sandbox Code Playgroud)

为了保持一致的行为,您可能希望将它们全部重新绑定。

如果 VSCode 自此回答以来添加了任何新的键绑定,我建议您打开键盘快捷键窗口并在Shift+F4那里搜索。


Wos*_*osi 6

版本1.9.0中的新功能

执行search.action.focusNextSearchResult(F4)

search.action.focusPreviousSearchResult(CTRL+ F4)

原始答案

遗憾的是,目前没有命令转到搜索结果窗格中的下一个条目.作为一种解决方法,您可以执行workbench.view.search(默认情况下*绑定到CTRL+ Shift+ f)并导航到下一个项目并选择它ENTER.

当您执行actions.find(默认绑定为Shift+ f)以便仅在当前文件中查找文本时,您可以使用editor.action.nextMatchFindAction通常绑定的命令F3.它的默认绑定声明如下:

{ 
  "key": "f3",                    "command": "editor.action.nextMatchFindAction",
                                  "when": "editorFocus" 
}
Run Code Online (Sandbox Code Playgroud)

默认快捷方式基于Windows版本的VSCode