Skip to content
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

From URI to file, line, column #1

Open
bsddemon opened this issue Jan 12, 2023 · 7 comments
Open

From URI to file, line, column #1

bsddemon opened this issue Jan 12, 2023 · 7 comments

Comments

@bsddemon
Copy link
Collaborator

We need something to get from URI to file, line, column in Rascal (scripts)

@jurgenvinju
Copy link
Member

Ok. I need a little more information. Who produces and who consumes which information? We have code for this kind of thing we can steal/reuse from other IDEs probably.

@bsddemon
Copy link
Collaborator Author

As I see it the extension is very simple and only calls a Rascal script (in a certain directory with a fixed name).
This script is in the Git archive the user works on.
So with branches the user always uses the version of the script that belongs to that version of the archive.
The Rascal script produces some output.
The extension consumes the output of the Rascal script and uses it to provide feedback in the IDE.

This way we do not need to upgrade the extension when new architectural rules become available.
In fact we only need to install it once and it will work for all checked out versions of an archive.

@jurgenvinju
Copy link
Member

Ok that's a cool setup for now, we could use the RASCAL.MF file to configure the name of the module and the name of the main function. However, what was your question wrt the source location?

@bsddemon
Copy link
Collaborator Author

Somehow we need a conversion from URI (Rascal) to file, line, column (VS).
We can do this conversion in Rascal or in VS.
I want to keep the extension as simple as possible.
Therefore, I prefer to do it in Rascal.

@jurgenvinju
Copy link
Member

Yes that sounds ok. Let's first decide how we will let the VScode extension communicate with Rascal. Starting up a JVM takes time, so usually it's best to:

  • start a JVM server when the VScode extension is loaded
  • connect a socket right there and then
  • send analysis requests over the socket

We could use JSON-RPC for that, if C# has a library for that. That way we can send file, line, column objects
and receive them on the Rascal side, convert them to source locations, and call the right function.

If the JSON-RPC connection is bi-directional, then we can implement the IDEServices interface going in the other direction,
and the Rascal code can use this to:

  • show messages
  • register diagnostics/problems
  • execute refactorings/rewrites

We can start small and only implement the diagnostics. This way people can write their analysis code in the VScode or Eclipse IDE and test them, and then run them in MS Visual Studio without changing a line of code.

@jurgenvinju
Copy link
Member

BTW, JSON-RPC is also used to implement the Rascal VScode extension, so that is also a motivation (to keep things simple and consistent and to share as much code as possible.)

@jurgenvinju
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants