Skip to content

Commit

Permalink
internal/lsp/command: add an interface for workspace/executeCommand
Browse files Browse the repository at this point in the history
This CL lays the groundwork for future refactoring, by defining a formal
(Go) interface for the set of commands provided by gopls in the
workspace/executeCommand RPC. It then creates some boilerplate bindings
via code generation.

The intent is to, first of all, clean up our current usage of commands.
Currently the 'specification' of a command is really split across
internal/lsp/command.go, internal/lsp/source/command.go, and
internal/lsp/source/code_lens.go. Changing a command signature might
require altering all three of those files, and it's easy to get wrong.

But also, we'd like to eventually be able to tell plugin authors that
they can call our commands in an ad-hoc manner (meaning with arguments
that they assign, rather than extract from a code lens). In order to do
that, we need to be able to generate documentation for the command
signature, and should also stop using positional arguments.  This CL
aims to solve that as well, by providing a commandmeta package that can
be used for document generation.

For golang/go#40438

Change-Id: I0d29de044e107d6e7b267f340879a5282f0b4944
Reviewed-on: https://go-review.googlesource.com/c/tools/+/289489
Trust: Robert Findley <[email protected]>
Run-TryBot: Robert Findley <[email protected]>
gopls-CI: kokoro <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
  • Loading branch information
findleyr committed Feb 9, 2021
1 parent d2671c4 commit 86984b8
Show file tree
Hide file tree
Showing 7 changed files with 873 additions and 0 deletions.
266 changes: 266 additions & 0 deletions internal/lsp/command/command_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 86984b8

Please sign in to comment.