Vscode: Add suggestions for key binding when clause contexts

Created on 14 Jul 2016  路  8Comments  路  Source: microsoft/vscode

When the user is creating custom keybindings, we now have suggestions (IntelliSense) for command ids.

Suggestions for then when clause contexts (ex, editorFocus, inDebugMode, etc) would also be useful.

context-keys feature-request keybindings-editor

Most helpful comment

It would still probably be better than no suggestions.

All 8 comments

Suggestion for new when clause contexts: contexts related to the source control viewlet. e.g. sourceControlViewletFocus, souceControlInputBoxFocus, sourceControlFilesStaged, etc.

@alexandrudima is there a central place where all the contexts are known so we inject this into the schema? If yes could you provide a code pointer, somebody might want to do a PR. Maybe @gregvanl

@isidorn No, at this time, keybindings are contributed at runtime from various parts of our system...

Would it be possible to add a 'when clause' that checks the name of currently active integrated terminal? That would make it so much easier to implement specific functionality for different types of terminal usage.

@alexandrudima, Is it possible to inject them as simple text?


Some of the context keys

editorFocus
textInputFocus
editorReadonly
editorHasSelection
editorHasMultipleSelections
editorTabMovesFocus
isInEmbeddedEditor
canUndo
canRedo
editorLangId
editorHasCompletionItemProvider
editorHasCodeActionsProvider
editorHasCodeLensProvider
editorHasDefinitionProvider
editorHasDeclarationProvider
editorHasImplementationProvider
editorHasTypeDefinitionProvider
editorHasHoverProvider
editorHasDocumentHighlightProvider
editorHasDocumentSymbolProvider
editorHasReferenceProvider
editorHasRenameProvider
editorHasDocumentFormattingProvider
editorHasDocumentSelectionFormattingProvider
editorHasSignatureHelpProvider

supportedCodeAction

findWidgetVisible
findInputFocussed
replaceInputFocussed

markersNavigationVisible

messageVisible

parameterHintsVisible
parameterHintsMultipleSignatures

inReferenceSearchEditor

referenceSearchVisible
referenceSearchTreeFocused

renameInputVisible

inSnippetMode
hasNextTabstop
hasPrevTabstop
hasSnippetCompletions

suggestWidgetVisible
suggestWidgetMultipleSuggestions
suggestionMakesTextEdit
acceptSuggestionOnEnter

hasOtherSuggestions

atEndOfWord

hasWordHighlights

accessibilityHelpWidgetVisible

listFocus
listSupportsMultiselect
listHasSelectionOrFocus
listDoubleSelection
listMultiSelection

historyNavigationEnabled

inputFocus

isMac
isLinux
isWindows

breadcrumbsPossible
breadcrumbsVisible
breadcrumbsActive

notificationFocus
notificationCenterVisible
notificationToastsVisible

activePanel
panelFocus

inQuickOpen

sidebarVisible
sideBarFocus
activeViewlet

activeEditor
editorIsOpen
groupActiveEditorDirty
textCompareEditorVisible
textCompareEditorActive
activeEditorGroupEmpty
multipleEditorGroups
inZenMode
splitEditorsVertically

resourceScheme
resourceFilename
resourceLangId
resource
resourceExtname
resourceSet
isFileSystemResource
isFileSystemResourceOrUntitled

workbenchState
workspaceFolderCount

multiCursorModifier

reviewPanelVisible

debugType
debugConfigurationType
debugState
inDebugMode
inDebugRepl
breakpointWidgetVisible
inBreakpointWidget
breakpointsFocused
watchExpressionsFocused
variablesFocused
expressionSelected
breakpointSelected
callStackItemType
loadedScriptsSupported
loadedScriptsItemType

workspaceRecommendations
workspaceFolderRecommendations
addToWorkspaceRecommendations
addToWorkspaceFolderRecommendations

nonEmptyWorkspace
searchExtensions
hasInstalledExtensions
searchBuiltInExtensions
recommendedExtensions
defaultRecommendedExtensions
groupByServersContext

profileSessionState
extensionHostProfileRecorded

explorerViewletVisible
filesExplorerFocus
openEditorsVisible
openEditorsFocus
explorerViewletFocus
explorerResourceIsFolder
explorerResourceReadonly
explorerResourceIsRoot

fileCopied

groupFocusedInOpenEditors
dirtyEditor
resourceSelectedForCompare

saveConflictResolutionContext

problemsViewFocus
problemFocus
problemsFilterFocus
relatedInformationFocus

outlineFiltered
outlineFocused

inOutput
activeLogOutput

inSettingsEditor
inSettingsJSONEditor
inSettingsSearch
settingsTocRowFocus
inKeybindings
inKeybindingsSearch
keybindingFocus

dirtyDiffVisible

searchViewletVisible
searchViewletFocus
inputBoxFocus
searchInputBoxFocus
replaceInputBoxFocus
patternIncludesInputBoxFocus
patternExcludesInputBoxFocus
replaceActive
hasSearchResult
firstMatchFocus
fileMatchOrMatchFocus
fileMatchOrFolderMatchFocus
fileMatchFocus
folderMatchFocus
matchFocus

taskRunning

terminalIsOpen
terminalFocus
terminalTextSelected
terminalFindWidgetVisible
terminalFindWidgetInputFocused
terminalFindWidgetFocused

webviewFindWidgetVisible

interfaceOverviewVisible

interactivePlaygroundFocus

canNavigateBack
canNavigateForward

@usernamehw if we had a hard coded list of context keys it would be easy to add them.
However having a hard coded list has the down side that we have to manage that list, and it might easily get out of sync with reality

It would still probably be better than no suggestions.

Is this still a possibility?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VitorLuizC picture VitorLuizC  路  3Comments

lukehoban picture lukehoban  路  3Comments

chrisdias picture chrisdias  路  3Comments

sijad picture sijad  路  3Comments

trstringer picture trstringer  路  3Comments