usethesource / rascal-language-servers

An LSP server for Rascal which includes an easy-to-use LSP generator for languages implemented in Rascal, and an interactive terminal REPL.
BSD 2-Clause "Simplified" License
10 stars 7 forks source link

hover help makes no sense with slightly more complex expressions #268

Open jurgenvinju opened 1 year ago

jurgenvinju commented 1 year ago

Describe the bug image

image

image

image

This is just an example.

The type reported for dinfo is bool here and str there, but DeclarationInfo elsewhere. In fact it should be list[DeclarationInfo].

However, the reference is alway correctly resolved. This is because there is no ambiguity with references in this tree. There are only those references in the scope of the cursor. There are, however, many different documentation strings one could show.

The eclipse code for this feature would work "inside-out" and not stack documentation strings. So if you hover on dinfo you'd get the location of that lexical and look that up in the documentation relation. If you'd want information on the parent of dinfo you'd have to however whitespace or operators of that level in the tree.

The code for looking up the tree that represents the cursor best is in TreeAdapter and can be easily reused for this purpose. All you need is a tree..