Visual Studio 键盘快捷键选项的代码列表

Visual Studio Code list of keyboard shortcuts options

Visual Studio 代码在其键绑定中是高度可定制的,尤其是在涉及上下文绑定时(使用 "when" 将相同的快捷方式绑定到不同上下文中的不同命令)。

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

有人可以提供这样的列表吗?

希望这些是可以在when条件下使用的所有变量:

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

您可以用 && 连接它们并用 ! 反转它们。例如

editorTextFocus && !editorTabMovesFocus 

已更新。 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

when clause 文档已移至 when clause contexts

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

最好的办法是使用 Developer: Inspect Context Keys 命令。有关该命令的更多信息,请参阅


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