Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: make a decision about the CLI #63693

Open
adonovan opened this issue Oct 23, 2023 · 3 comments
Open

x/tools/gopls: make a decision about the CLI #63693

adonovan opened this issue Oct 23, 2023 · 3 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Oct 23, 2023

gopls has a command-line interface that exposes many useful pieces of server functionality (e.g. show analysis diagnostics, rename an identifier) in a form that can be easily invoked from a shell script or other program. Since we no longer support the older separate CLI tools (e.g. gorename), there is a case to be made that should be a first-class interface. However, it is currently nominally "experimental".

The task of this issue is to:
(a) figure out roughly how many people use the CLI tool in its current form. Telemetry should make this easy.
(b) decide whether to publish a stable, coherent, and well-documented set of command-line operations, and, if so,
(c) build and document it.

Another possibility we should consider is whether to provide a pure LSP client (I am guessing such a thing exists) that knows nothing of gopls. This may be less work overall and may align better with standard client-side ways of doing things, though it's also possible that it's more verbose, or clunky, or just can't easily express all the things we would like it to do.

@adonovan adonovan added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. FeatureRequest labels Oct 23, 2023
@gopherbot gopherbot added this to the Unreleased milestone Oct 23, 2023
@findleyr
Copy link
Contributor

We already have a headless LSP client for our regression tests (and, indeed, another slightly less robust headless client for the current command line interface).

IMO it would be more generally useful to extract this as a general purpose command-line interface for LSP servers. If we maintain the current CLI and regression tests we are effectively maintaining a headless client anyway, so why not share it in a more useful way?

@findleyr findleyr modified the milestones: Unreleased, gopls/backlog Oct 24, 2023
@adonovan
Copy link
Member Author

IMO it would be more generally useful to extract this as a general purpose command-line interface for LSP servers. If we maintain the current CLI and regression tests we are effectively maintaining a headless client anyway, so why not share it in a more useful way?

It would certainly be more useful, but I wonder who would actually use it, and how much additional burden it would impose to attempt to remain strictly server-agnostic or to deal with the quirks of more than one actual server. It might also make it harder to use with gopls, and, by being in a separate executable, might introduce IPC or version skew issues that we can ignore in the current approach. I'm not opposed, but we should go into it with a clear understanding of the costs and benefits.

@muirdm
Copy link

muirdm commented Oct 28, 2023

I imagine custom features of the CLI would also be useful to Go specific editor modes wanting tight integration. Maybe custom behavior could be kept organized as LSP actions (or whatever they are called) which could be presented on the gopls CLI as "native" operations, but still accessible from generic LSP clients. If you tried to use one of these custom operations against a non-gopls server, you would get a <whatever> action not supported error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants