I recently need to access the commands and titles of VSCode plug-ins/extensions.

A command in VSCode has two parts: the command itself (dot-separated string, e.g., python.select.interpreter) and a title, which is in English explaining the command, e.g., “Choose a Python interpreter”. You can refer to the info from the offical doc here.

However, in many cases, the titles are actually stored in another file. This is the case for the official Python extension of VSCode. If we look into package.json of this extension, it’s like this

  "category": "Python",
  "command": "python.analysis.restartLanguageServer",
  "title": "%python.command.python.analysis.restartLanguageServer.title%"

So where is the variable %python.command.python.analysis.restartLanguageServer.title% defined at?

It’s in another file package.nls.json like this:

"python.command.python.analysis.restartLanguageServer.title": "Restart Language Server",

I assume it is for the purpose of making multi-language or i18n easier. The titles can be in any language depending on the use configuration.

The title eventually displayed to the user is {displayName}: {title} where displayName is defined in package.json of the extension, e.g., “Python: Restart Language Server”.