-
Notifications
You must be signed in to change notification settings - Fork 257
Removes local variables from outline #594 #734
Conversation
Is this something clients expect? (I'm honestly not sure). I thought that symbols search should include every def in a file, and I think (though I'm not 100% sure) this is what VSCode does for other languages. Could you filter on the client side using the symbol kind? Perhaps we could tweak the symbol kinds to make this possible if it is not. |
Look what I have found:
|
Yeah, I think it doesn't have an outline view. There is only one message in the LSP for both symbol search and outline, and that is |
Exactly. That's why this line on rls/src/lsp_data.rs |
We could use |
Both C# and C++ language servers filter local variables. Moreover both these LS are developed by Microsoft, so it may treated as de-facto standard. I think this nuance should be menthioned in the standard too despite it is not appliable to all languages. Created an issue microsoft/language-server-protocol#414 |
If we follow microsoft's interpretation for static typed languages here, then the problem is kind of solved by this patch. On the other hand, I see there is a problem with the translation of Racer kinds to Language Server kinds. For example, Eclipse's Java Language Server translation is a little bit different. They map IJavaElement.FIELD to SymbolKind.Field. If we do as @nrc suggested, we can filter local variables on the client for the outline view but still make them reachable through the symbol search. Another issue is hierarchy. If we had hierarchy #86, clients could achieve the same effect by removing variables that are under a function symbol. |
I've also opened issue similar to #86 : microsoft/language-server-protocol#327 |
This reverts commit fb073a5.
Changes: Union -> Enum, Method -> Method, Field -> Field, Static and Const -> Constant, TupleVariant and StructVariant -> Field. Leaving Variable only for local variables. Comment for future update to LSP 3.
I reverted the previous commit and changed the mapping from Rust kinds to the spec kinds according to the comments before. Should I change the title of this PR or create a new one? We should probably ask @DSpeckhals his opinion on this mapping as well since he added TupleVariant and StructVariant. I'm not sure what they mean. Aren't they enum members? I have also noticed that the SymbolKind on languageserver-types is outdated |
Yes, |
I read the PR comments, but I can't say that I understood it completely. Is there a reason TupleVariant must be mapped to SymbolKind::Constant and StructVariant to SymbolKind::Class? Can't they just be SymbolKind::Field? |
It was just to differentiate between the different types of tuple variants. I believe I looked at the TypeScript mappings, and tried to do what it did with enum variants. |
Thanks for the update! |
This change removes local variables from outline making it much more useful, at least in Atom IDE.