Visual Studio Code键盘快捷键选项列表

时间:2015-10-07 08:43:18

标签: visual-studio-code

Visual Studio Code在其键绑定中具有高度可自定义性,特别是在涉及上下文绑定时(使用"when"将相同的快捷方式绑定到不同上下文中的不同命令)。

我正在寻找可以在"when"条件中使用的变量列表。 (有一个很棒的list of commands,但条件没有列在那里)。我看到条件是一个必须求值为布尔值的JavaScript表达式,但不清楚范围内的变量是什么。

有人可以提供这样的清单吗?

4 个答案:

答案 0 :(得分:15)

希望所有可以在when条件中使用的变量:

editorFocus
editorHasMultipleSelections
editorHasSelection
editorLangId == 'name' // for example: editorLangId == 'typescript' 
editorTabMovesFocus
editorTextFocus
findWidgetVisible
globalMessageVisible
inChangeAllMode
inDebugMode
inQuickOpen
inReferenceSearchEditor
inSnippetMode
markersNavigationVisible
parameterHintsVisible
peekDeclarationVisible
quickFixWidgetVisible
referenceSearchVisible
renameInputVisible
searchViewletVisible
suggestWidgetVisible
textCompareEditorVisible

您可以使用&&连结它们,并将其与!反转。例如

editorTextFocus && !editorTabMovesFocus 

答案 1 :(得分:4)

更新。 2019年4月(版本1.34)

版本1.34 when条件中可以使用的所有变量的列表:

acceptSuggestionOnEnter
accessibilityHelpWidgetVisible
activeEditor
activeEditorGroupEmpty
atEndOfWord
breadcrumbsActive
breadcrumbsPossible
breadcrumbsVisible
breakpointSelected
breakpointWidgetVisible
breakpointsFocused
callHierarchyVisible
commentEditorFocused
config.breadcrumbs.enabled
config.editor.stablePeek
config.editor.tabCompletion
config.emmet.triggerExpansionOnTab
config.gitlens.keymap
debugConfigurationType
debugState
debugType
dirtyDiffVisible
editorFocus
editorHasCallHierarchyProvider
editorHasCodeActionsProvider
editorHasCompletionItemProvider
editorHasDefinitionProvider
editorHasDocumentFormattingProvider
editorHasDocumentSelectionFormattingProvider
editorHasImplementationProvider
editorHasMultipleSelections
editorHasReferenceProvider
editorHasRenameProvider
editorHasSelection
editorHasSignatureHelpProvider
editorIsOpen
editorLangId
editorReadonly
editorTabMovesFocus
editorTextFocus
explorerResourceCut
explorerResourceIsFolder
explorerResourceIsRoot
explorerResourceMoveableToTrash
explorerResourceReadonly
explorerViewletFocus
explorerViewletVisible
expressionSelected
fileMatchFocus
fileMatchOrFolderMatchFocus
fileMatchOrMatchFocus
filesExplorerFocus
findInputFocussed
findWidgetVisible
firstMatchFocus
folderMatchFocus
gitlens:activeFileStatus
gitlens:canToggleCodeLens
gitlens:enabled
gitlens:key:,
gitlens:key:.
gitlens:key:escape
gitlens:key:left
gitlens:key:right
hasNextTabstop
hasOtherSuggestions
hasPrevTabstop
hasSearchResult
hasSnippetCompletions
hasWordHighlights
historyNavigationEnabled
historyNavigationWidget
inBreakpointWidget
inDebugMode
inDebugRepl
inEditorsPicker
inFilesPicker
inKeybindings
inKeybindingsSearch
inQuickOpen
inRecentFilesPicker
inReferenceSearchEditor
inSettingsEditor
inSettingsSearch
inSnippetMode
inViewsPicker
inZenMode
inputBoxFocus
inputFocus
interactivePlaygroundFocus
interfaceOverviewVisible
isDevelopment
isInDiffEditor
isInEmbeddedEditor
keybindingFocus
listFocus
listHasSelectionOrFocus
listSupportsMultiselect
markersNavigationVisible
matchFocus
messageVisible
multipleEditorGroups
notificationCenterVisible
notificationFocus
notificationToastsVisible
parameterHintsMultipleSignatures
parameterHintsVisible
problemFocus
problemsFilterFocus
problemsViewFocus
python.datascience.featureenabled
python.datascience.hascodecells
python.datascience.ownsSelection
reference-list.hasResult
referenceSearchTreeFocused
referenceSearchVisible
remoteFileDialogVisible
renameInputVisible
replaceActive
replaceInputBoxFocus
replaceInputFocussed
scmRepository
searchInputBoxFocus
searchViewletFocus
searchViewletVisible
settingsTocRowFocus
suggestWidgetMultipleSuggestions
suggestWidgetVisible
suggestionMakesTextEdit
supportedCodeAction
terminalFindWidgetFocused
terminalFindWidgetVisible
terminalFocus
terminalTextSelected
textCompareEditorVisible
textInputFocus
variablesFocused
watchExpressionsFocused
webviewFindWidgetVisible
workbench.explorer.openEditorsView.active

答案 2 :(得分:2)

when clause 文档已移至 when clause contexts

但它基本上与之前可用的信息相同,不幸的是,它没有提供大量可用上下文列表。

最好的办法是使用 Developer: Inspect Context Keys 命令。有关该命令的详细信息,请参阅 https://stackoverflow.com/a/65584576/836330


when 上下文的智能感知在 v1.54 中,请参阅 Intellisense for Context Keys 。虽然现在我必须用 Ctrl+Space 来触发它,但智能感知似乎并不会仅仅通过输入一些字母来弹出:

context key intellisense

答案 3 :(得分:1)

做了一个小的扩展,为"when"上下文添加了自动完成功能:

https://marketplace.visualstudio.com/items?itemName=usernamehw.when-suggest

demo autocomplete in keybindings.json "when" context