microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.71k stars 29.08k forks source link

Should RawContextKey include a description and whether context should be user facing? #114867

Closed gregvanl closed 3 years ago

gregvanl commented 3 years ago

Per final comment in https://github.com/microsoft/vscode-docs/issues/3039, people proposed adding a description to RawContextKey and an indication whether the context is meant to be used by end users (keybindings) or extension authors.

This information could be surfaced in Inspect Context Keys or perhaps in when clause IntelliSense.

jrieken commented 3 years ago

I have pushed a change that allows users of RawContextKey to provide a description. The description, the name, and the type (iff available) are collected in a static registry. That registry can then be inspected, right now only via a command: _generateContextKeyInfo will print all values onto the console... This is similar to the _generateCommandsDocumentation command and the output form can be tweak to any likings. However, fasten your seatbelt, there are many context keys... It depends on the installed extensions but in my dev sample I have ~580...

We can also find ways to feed this information to the extension host (via another command) and then teach the configuration editing extension to suggest them whenever a context key is being edited

jrieken commented 3 years ago

Closing we have the core functionality now. I will give a team shout to adopt this better (which likely will take a while)

jrieken commented 3 years ago

Verify that you can bind a keybinding to _generateContextKeyInfo and that it prints all context keys onto the dev tools console