microsoft / language-server-protocol

Defines a common protocol for language servers.
https://microsoft.github.io/language-server-protocol/
Creative Commons Attribution 4.0 International
11.1k stars 778 forks source link

New feature : LSP gutter support #2009

Open angelozerr opened 2 weeks ago

angelozerr commented 2 weeks ago

In IntelliJ, there is gutter support https://www.jetbrains.com/help/idea/guided-tour-around-the-user-interface.html#gutter which is very nice to execute action with a gutter which is an icon displays on the left of the editor for a given line.

For instance for some command like, run,debug, language server displays a Codelens which polluate the editor (if there are some other codelens like references, implementations).

If you see https://github.com/redhat-developer/lsp4ij/discussions/479, you can see Run, Debug codelens for rust-analyzer

image

IMHO Ithink it should be better to display those Run, Debug codelens as gutter:

image

image

//cc @fbricon @datho7561 @rgrunber

jwortmann commented 2 weeks ago

Afaik there is nothing preventing IntelliJ to implement the code lenses in form of gutter icons. In general, many of the features from the LSP specs are designed to be Editor UI agnostic, i.e. the client can decide how to implement the UI.

For example this is how code lenses are presented by default in Sublime Text, in form of a floating annotation at the righthand side:

code-lens-annotation

However, something which I imagine might be useful for your use case would be to add an optional kind property or similar to the CodeLens object, with values like test, references, etc.; then this could be used to determine an icon for the code lens (or perhaps you only want to present test in the gutter, but other code lens kinds inline for example).