-
Notifications
You must be signed in to change notification settings - Fork 9
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
Create a callback function for vs code when editor selection changes. #241
Comments
Interesting idea. Could be very useful for other things as well. I wonder if we could try and get some synergy with these features: microsoft/language-server-protocol#377 such that we don't extend the protocol in a direction that has to be changed later. |
Also, if we would indeed pass it to the webview (after some dejittering), we would still need to do work to pass this back to rascal. but i'm wondering, @tpnbolwerk is this for a DSL, or would you like it for any selection that happens? |
The general idea is to either use hover, with the additional location parameter as the rust people did, or connect it to the command interface such that the location is a command parameter. Other LSP s have extended in either direction. I'd like to find out which has the most chance of being included in the protocol for the long run. |
I think the vs code rascal language server already has some information in its debugging output that we might use. This is the message when hovering in the DSL text document.
Is it possible to get this debugging information? |
This functionality is trigger by the hover lsp for a DSL. This reads from the |
Is your feature request related to a problem? Please describe.
I want to create a way to visualize a selection in the editor of vs code. I could not find a way to get the vs code editor selection by using the rascal language server vs code extension.
Describe the solution you'd like
In RascalLSPConnection by adding the following lines we could get the active text editor selection information. We can propagate this e.g. to the webview like is done below, or create a callback function as an interface for Rascal.
vscode.window.onDidChangeTextEditorSelection((s) => {
const selection = vscode.window.activeTextEditor?.selection;
if(selection){
panel.webview.postMessage({selection : JSON.stringify(selection)})
}
});
Describe alternatives you've considered
I see no other way than changing the vs code extension in order to get access to the vs code API that supports the previously mentioned callback function, since in Rascal we do not have access to all its features.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: