While adding a few new context keys I added during this milestone I noticed that our documentation (raw file) around context keys is missing some newer contexts we added.
@microsoft/vscode I did a quick check over our context keys and here are most of them that are either missing or need review. Please check this out during endgame and see if a key should be added. I do not think we should add each and every key, but some may be useful for users to know:
cancellableOperation
editorTabMovesFocus
canUndo
canRedo
findInputFocussed
replaceInputFocussed
markersNavigationVisible
referenceSearchTreeFocused
hasNextTabstop
hasPrevTabstop
atEndOfWord
hasWordHighlights
accessibilityHelpWidgetVisible
accessibilityModeEnabled
multiCursorModifier
callHierarchyVisible
breadcrumbsPossible
breadcrumbsVisible
breadcrumbsActive
webviewFindWidgetVisible
webviewFindWidgetFocused
terminalA11yTreeFocus
terminalTextSelected
terminalFindWidgetVisible
terminalFindWidgetInputFocused
terminalFindWidgetFocused
taskRunning
commentThreadIsEmpty
commentIsEmpty
commentEditorFocused
searchViewletFocus
problemsViewFocus
problemFocus
problemsFilterFocus
relatedInformationFocus
remoteAuthority
remoteName
remoteConnectionState
remoteFileDialogVisible
There are lots of keys defined in these files too:
src/vs/workbench/contrib/debug/common/debug.ts @isidorn
src/vs/workbench/contrib/search/common/constants.ts @roblourens
src/vs/workbench/contrib/files/common/files.ts @isidorn
Here's an idea: Have a scheduled daily task on Azure DevOps programmatically running find references on RawContextKey and put the result into a JSON. Generate that doc table from the JSON. I also noticed our theme color keys get outdated.
We have tried to keep the context key list to a reasonable number and have left out those which are only used by VS Code and not likely useful for users. Just be mindful whether there is a scenario where a user or extension author would need that context key.
@octref I think it would not be good to add all of the keys we have, we should make a careful case by case decision because a lot of these keys are only added e.g. to have conditional menu items.
What I find odd for context keys is that I cannot put a description to them when creating, unlike our workbench theme colors.
I also noticed our theme color keys get outdated.
Well, at least you get intellisense for them when writing a theme. There is no UI to tell you the keyboard context keys available unfortunately.
I opt to keep taskRunning internal since it is only used to control state for actions the core contributes.
remoteFileDialogVisible is used to add the ctrl+O keybinding to open local when the remote file dialog is visible and doesn't have much use externally.
What I find odd for context keys is that I cannot put a description to them when creating, unlike our workbench theme colors.
We could actually tackle that. Context keys are usually defined via RawContextKey and we could add a description property and a flag if they are user-facing or not
Most helpful comment
We could actually tackle that. Context keys are usually defined via
RawContextKeyand we could add a description property and a flag if they are user-facing or not