Replies: 5 comments 2 replies
-
I suspect also one would need to use semantic tokens, as you say, but the standard list is defined in https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#semanticTokenModifiers Nothing stops a language server and a client to support additional modifiers, but they are not part of the predefined set. I do not know why the spec is so restrictive (you will find several issues in GitHub if you look for it), but since it is so restrictive, I think a Java specific solution should not be part of the basic LSP4E plugin. One could be prepared tough in the LSP4E JDT project, if someone can contribute it. |
Beta Was this translation helpful? Give feedback.
-
Hi @rubenporras, I guess, the visibility modifiers are too language-specific why they might be left out of the LSP standard. According to the spec, a language server could add custom token modifiers, declaring them in the In my case, I want to add visibility details for CDT LSP, so I guess, clangd would need some kind of extension to support that, right? I think, in that case you're right. This feature has to be implemented in a language-specific plug-in. @ghentschke, FYI |
Beta Was this translation helpful? Give feedback.
-
This IMO should be discussed on the LSP spec to include a concept of "visibility", just like it has a concept of "kind", and the response of the So I think best is now to open an enhancement issue to the spec, maybe even with a PR proposing a change, and link it back there. |
Beta Was this translation helpful? Give feedback.
-
Good point, @mickaelistria. I checked existing issues on the spec and it turns out, there is already an issue and a related discussion proposing a more general approach using
I fully agree. I think, we should continue the discussion on the spec and come back to LSP4E as soon as there is a need to adopt a new spec version. |
Beta Was this translation helpful? Give feedback.
-
Update Involved PRs:
Exemplary outline view for a C++ code example Open questions
|
Beta Was this translation helpful? Give feedback.
-
Comparing the icons used in the traditional CDT outline view with that of CDT LSP outline view, there is a lack of information in the CDT LSP outline view: the classes', methods', and attributes' visibility, i.e. public / private / package) is not shown. It seems, the reason are limitations in LSP4E. Im thinking about how to add these details to LSP4E. Could someone give me some advise?
CDT outline view example:
CDT LSP outline view example:
Java outline view example for similar code:
C++ code example:
LSP4E has a
SymbolsModel
used, e.g. by CDT LSP, for the outline view. The methodorg.eclipse.lsp4e.outline.SymbolsLabelProvider#getImage(Object element)
returns the icons, calculated byorg.eclipse.lsp4e.ui.LSPImages#imageFromSymbolKind(SymbolKind kind)
based on the kind of the element in the outline view. The kind is something like a class, a method, a field, or a property. The elements' details / token modifiers like visibility (public / private / package or package visibility in Java) seem not to be considered here. It seems, aDocumentSymbolWithURI
that an icon is looked up for, does not have any details about visibility, e.g. some tags set on theDocumentSymbolWithURI
.Do I miss something? Do we have to send additional requests to the language server to receive the details about visibility (e.g. using the LSP endpoint textDocument/semanticTokens)? Is visibility supposed to be illustrated by decorator icons instead of different element icons like in CDT and JDT?
Beta Was this translation helpful? Give feedback.
All reactions