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
14 stars 8 forks source link

Make the Rascal VSCode plugin even better #486

Open PaulKlint opened 3 days ago

PaulKlint commented 3 days ago

First of all, the VSCode plugin for Rascal already gives a fantastic user experience. Here are some suggestions to make it even better

Running a Rascal module via the Explorer

Right clicking on a file name in the Explorer gives a menu with entries:

can we make these work for Rascal?

When positioned on a Java file the following entries are added:

It would be very convenient to have entries

Debugging

jurgenvinju commented 3 days ago

These are very nice ideas. Thanks

But these suggestions, however we design them, sound to me of the "how did we ever do without"-kind.

PaulKlint commented 2 days ago

As already mentioned above, popup menus are used widely in VsCode to start execution, debugging etc. It maybe the case though, that these interactions are VSCode-specific and not LSP-specific.

In addition, I think that the use of code lenses to start execution (although funny) has its disadvantages:

jurgenvinju commented 2 days ago

I'm guessing these menus are Eclipse specific, because the Java support in VScode is fully based on porting the Eclipse support for java. The rest of VScode and the LSP works more with commands under keyboard access and editor features.

But that's very true what you say; the lenses don't work for the resource views at all. And that's not useful.

Perhaps we can infer popup menu entries for files, from the lenses that are tagged to the entire file and have the best of both worlds. That way we program the feature once, and we get access in the UI in several useful ways.

DavyLandman commented 4 hours ago

There are a few things I want to add. And I agree with Jurgen, some of the patterns you've observed Paul are specific to how the Java VS Code extension has designed the interaction, which indeed has some Eclipse style interactions in there.

I find that the extension documentation of VS Code has quite some interesting guidelines for extension authors. An often repeated advice is not to expose the same feature in multiple places. But specifically around execution & code lenses & debugging, there is not a real UX guideline yet.

If you look at the debugging user guide it's all about the launch configurations. This is a point where developing the rascal debugger we spent quite some effort on (@yami2200 spent quite a few weeks on just this topic), so let met share those insights.

  1. The normal run/debug assumes a program is started from VS Code, runs, and terminates.
  2. There is no way to launch or debug an application without an entry in the launch.json file, with the exception that if there are no configurations in the whole workspace, there is some fallback behavior that you can configure. Rascal already does this, if you press the "play" triagle without any launch configurations, you'll get the REPL with that module active.
  3. We can, but with quite some work, automatically generate launch configurations, this is what Java extension does.
  4. REPLs are alive much longer than a normal program launch, and the UI will always have this "active launched thing" bar on the top of your editor, since it's still a running debug process.
  5. the :set debugging true (also discussed in usethesource/rascal#1994 ) was chosen since we wanted to soft launch the debugger. we need better discovery of it.

I think one of the problems is that right now, the way we "launch" rascal programs (import into a REPL and run it) is not really aligned with launch configuration assumptions in VS Code. Especially if they stay open for a long time. We could investigate how other extensions with REPLs have solved this?

Aside from that, I agree we need to make debugging more discoverable. But it will involve some effort, especially since we're not a regular process that is launched. Maybe we should model the "attach" style debuggging configurations for remote java processes. But we would have to figure out a way to automatically generate them, without spamming the launch configuration.