microsoft / vscode-languageserver-node

Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on node.js
MIT License
1.44k stars 325 forks source link

activation onCommand leads to 'command x not found' if using executeCommandProvider #293

Open christianvoigt opened 6 years ago

christianvoigt commented 6 years ago

Steps to reproduce:

  1. Register commands with an extension and use onCommand:myExtension.myCommand in activationEvents in the package.json.
  2. Add a language server with an executeCommandProvider for myExtension.myCommand
  3. Start debugging the language server and execute myExtension.myCommand in the command palette.

Result: The language server is activated correctly, but the command is not executed. Instead a Command 'myExtension.myCommand' not found. error pops up.

Executing the command a second time works as the language server is already running.

dbaeumer commented 6 years ago

This can only be fixed by adding constructor support for commands to the LSP client. In VS Code commands need to be registered in the activate function synchronously to make this work.