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

Create easy-to-discover-and-use upgrade refactoring UI for the move from annotations to keyword fields. #392

Open jurgenvinju opened 1 month ago

jurgenvinju commented 1 month ago

The update functionality in lang::rascal::upgrade::* on the current branch (remove-tree-loc-annotations) that refactors uses of annotation syntax to keyword parameter syntax is a candidate for inclusion in the Rascal LSP server:

It has to run on the entire project to make sense as the refactoring is "dumb"; it does not follow name resolution links it just replaces all syntactical constructs in a consistent manner.

Originally posted by @jurgenvinju in https://github.com/usethesource/rascal/issues/1974#issuecomment-2162825547

DavyLandman commented 1 month ago

Agreed, but I would be really interested in if we could do something where we don't bother users that are either not using annotations, or have already done the migration for a specific project.

jurgenvinju commented 1 month ago

We could add a lense at the top of every module that still uses annotations, and otherwise not at all. And optionally also add the same lense command near every use of annotation syntax?

The hover help should be insightful enough to explain that the lense will rewrite the entire project. @DavyLandman Do we have hover help on lenses already?

I've already integrated a file-by-file based progress bar (it could take a few seconds if the project is big).

DavyLandman commented 4 weeks ago

Yes, lets do that, only a top-level for modules that themselves use annotations (either define or use).

The hover help should be insightful enough to explain that the lense will rewrite the entire project. @DavyLandman Do we have hover help on lenses already?

Sadly -- at least the LSP -- code lenses only have a title. No way to add a hover information, so we're going to have to put that info in the title.

(If we do it using the raw VS Code api (so outside of LSP) we can give a tooltip, but that's not available via LSP.)