-
Notifications
You must be signed in to change notification settings - Fork 809
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
Add visibility to SymbolInformation #98
Comments
In Java there is package visibility, when there is no access modifier used. |
@kaloyan-raev what do you think would be best to represent package visibility in the proposal? |
Like this: enum Visibility {
Private = 1,
Package = 2,
Protected = 3,
Public = 4
} |
Better put "public" first, as it's the base case - other cases are kinds of restricted. |
Why does this have the 4.0 milestone? This is not a breaking change |
@wiz public is the highest visibility, so it should be the highest number. |
So, the visibility set is closed as no further levels can be added below "Private" and above "Public"? That would be unfortunate for non-Javy languages... |
I'm confused, below |
That would ruin the pretty ordering we have here. Adding
I propose leaving some wiggle room for the future additions while keeping confusion to the minimum. |
C# has 5 levels of accessibility: https://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx, also in this case the accessibility lattice is not a sub lattice of the integer lattice so you can't do simple integer comparisons to check accessibility. |
C# either has or is going to get a 6th level of accessibility, 'proternal', accessible only to things that derive from the type AND are in the same assembly. (compare with 'protected internal' which is accessible to things that either derive from the type OR are in the same assembly.) |
One concern I have is to avoid clutter. Imagine you're writing in a language where almost everything is private, apart from the few methods that are explicitly annotated with the modifier |
Up to the client to decide. It could grey it out if it's private, it could show an icon, it could just have checkboxes to filter like "only public". The protocol shouldn't make any UI decisions. |
My point is, it probably shouldn't be up to the client to decide. Only the language knows what is the default (and hence which one should be shown with unadorned icons). For instance: in Flow, if you write In C# the accessibility of things is confusing and there are lots of common options, so I expect every single declaration in C# to have a glyph indicating accessibility. |
I think @felixfbecker says it's up to the client to decide how to render once we know the visibility, and @ljw1004 says is that the default visibility is not desired. Both are fully compatible. |
I'm with @ljw1004 here. How would a generic client know that for language X, it should not decorate I agree that the symbol information should contain all available data. I believe that the problem arises from conflating the symbol information with selecting a glyph - the "icon" value can't be computed reliably from the SymbolInformation, so an optional field should be provided by the server when needed. The "icon" set can be more open than the "kind" one, so maybe this will address even #129. |
This could be addressed more generically with #889. The discussion in microsoft/vscode#23927 indicates any modifier, including visibility/access, could be accommodated. |
As discussed and concluded at microsoft/vscode#23927, a namespace https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/ |
It seems the LSP spec proposes a My original request comes from a requirement on LSP4E, CDT LSP, and clangd discussed here. |
I've prepared a proposal for additional SymbolTag values in PR #2003. Could someone please do a review? |
I propose an addition to
SymbolInformation
that allows an LS to report the visibility (private
,protected
,public
) to the client:A client can choose how he uses that information:
The same property could get added to
CompletionItem
.I think private, protected and public should cover all languages, or are there more modifiers in some languages?
The enum should be structured to allow something like
The text was updated successfully, but these errors were encountered: