Change:
This came from vscode-docs issue customer comment "The biggest missing documentation for extensions is the lack of setContext here " Should we add the description and metadata so that it will be part of the _generateCommandsDocumentation output?
FYI I would love this. At the same time, could we think about adding the corollary ? The number of hoops that need to be jumped through to get the right context make things very difficult (and other impossible). Here is a concrete example. In GitLens, I have commands that navigate forward and backward through revisions. The current diff editor behavior make these difficult to implement well -- leaving aside the details there, to work around it one solution I've come up with is duplicating those 2 commands, 1 for normal editors and 1 for diff editors. And then I have to duplicate all the placements ( and and then have the command behave appropriately based on the context. Alternatively, if there was a type api, I could avoid all of that, and just look up in my existing command and do the right thing. Way less complexity and explosion of commands and placements. Please?
I am also very concerned about this issue. I found the when I'm reading the source code of , but I didn't find it in , but in the . I hope the official team can fix this issue soon. Best wishes. : )
Like I found use of in the samples () and the 2016 update documentation. 2016 blog reference, but not in API docs and this issue has been open more than a year? Is it maybe considered "proposed API"?
seems like the issue belongs to , right?
same here too... unfortunately documentation is falling behind!
examples to Command Extension Guide with
Why is this still open? Are we happy that it is documented in the docs?

Discussion:
import { localize } from 'vs/nls'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration'; <del> import { ContextKeyExpression, ContextKeyInfo, ContextKeyValue, IContext, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget, IReadableSet, RawContextKey, SET_CONTEXT_COMMAND_ID } from 'vs/platform/contextkey/common/contextkey'; </del> <ins> import { ContextKeyExpression, ContextKeyInfo, ContextKeyValue, IContext, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget, IReadableSet, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; </ins> import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; const KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';

}); } <del> CommandsRegistry.registerCommand(SET_CONTEXT_COMMAND_ID, setContext); </del> <ins> CommandsRegistry.registerCommand('_setContext', setContext); </ins> CommandsRegistry.registerCommand({ id: 'getContextKeyInfo',

updateParent(parentContextKeyService: IContextKeyService): void; } <del> export const SET_CONTEXT_COMMAND_ID = 'setContext'; </del> function cmp1(key1: string, key2: string): number { if (key1 < key2) { return -1;

'vscode.experimental.editSession.continue', '_workbench.editSessions.actions.continueEditSession', 'Continue the current edit session in a different workspace', [ApiCommandArgument.Uri.with('workspaceUri', 'The target workspace to continue the current edit session in')], ApiCommandResult.Void <ins> ), // --- context keys new ApiCommand( 'setContext', '_setContext', 'Set a custom context key value that can be used in when clauses.', [ ApiCommandArgument.String.with('name', 'The context key name'), new ApiCommandArgument('value', 'The context key value', () => true, v => v), ], ApiCommandResult.Void </ins> ) ];