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

Add command to create rascal location from selection #283

Open linuswagner opened 1 year ago

linuswagner commented 1 year ago

This PR adds a command that allows users to get a Rascal location for their selection put into their clipboard.

If you review this, you should check the following things:

Limitations:

linuswagner commented 1 year ago

@jurgenvinju can you give this a look?

DavyLandman commented 1 year ago

Cool feature 👍🏼 I'm still on holiday, but I wanted to note that it's not an accurate calculation of a rascal location, since vs code is utf16 offset/column based, while rascal is utf32.

This line would mess up the offsets:

/* 👋🦾 */ println("Hi");

On Mon, 21 Aug 2023, 23:01 Linus Wagner, @.***> wrote:

@jurgenvinju https://github.com/jurgenvinju can you give this a look?

— Reply to this email directly, view it on GitHub https://github.com/usethesource/rascal-language-servers/pull/283#issuecomment-1687037191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABL3E5PLWORZQU4ZQMG4PDXWPEB5ANCNFSM6AAAAAA3Y54DC4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jurgenvinju commented 1 year ago

@linuswagner @DavyLandman let's fix the offsets together before we merge the PR. I'd also like to add a feature where a list of tagged locations can be collected in a file (configured by the user). That way we help many users that need to manually get some ground truth about a code corpus.

linuswagner commented 1 year ago

@linuswagner @DavyLandman let's fix the offsets together before we merge the PR. I'd also like to add a feature where a list of tagged locations can be collected in a file (configured by the user). That way we help many users that need to manually get some ground truth about a code corpus.

~Sure. Keep in mind that I've forked the repo for this PR, so you either fork the fork and create a PR on mine or we move my commit to a branch here and close this PR.~ Nvm, as Davy pointed out, you can directly commit on my main

DavyLandman commented 1 year ago

As the person that opens a PR, you can also choose to allow anyone with commit access to the repo to also have access on your branch.

On Tue, 22 Aug 2023, 13:50 Linus Wagner, @.***> wrote:

@linuswagner https://github.com/linuswagner @DavyLandman https://github.com/DavyLandman let's fix the offsets together before we merge the PR. I'd also like to add a feature where a list of tagged locations can be collected in a file (configured by the user). That way we help many users that need to manually get some ground truth about a code corpus.

Sure. Keep in mind that I've forked the repo for this PR, so you either fork the fork and create a PR on mine or we move my commit to a branch here and close this PR.

— Reply to this email directly, view it on GitHub https://github.com/usethesource/rascal-language-servers/pull/283#issuecomment-1688035636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABL3EZTDUSNXRYR2FL3B5DXWSMJDANCNFSM6AAAAAA3Y54DC4 . You are receiving this because you were mentioned.Message ID: @.***>

linuswagner commented 1 year ago

@DavyLandman thanks for the feedback. I'll be taking a look on Friday/the weekend and see what I can do.

DavyLandman commented 1 year ago

@DavyLandman thanks for the feedback. I'll be taking a look on Friday/the weekend and see what I can do.

awesome 👍🏼

linuswagner commented 10 months ago

@DavyLandman took a bit longer than expected, but UTF16 characters now work. I have essentially written the inverse of the functions in RascalTerminalLinkProvider. They currently are also in the same file.

If you give me a rough description of the interface you want for UTF8 <-> UTF16 conversion (including where to place it), I can also do the refactoring you further up.

DavyLandman commented 10 months ago

also @linuswagner the build is failing due to some of es-lint messages, you can run it by npm run lint and try and fix those.

linuswagner commented 10 months ago

@DavyLandman All done. Can you also please check vsCodeToRascalRange. I'm a bit confused when it comes to the lines when they should be 1-based and when 0-based

jurgenvinju commented 10 months ago

This is a lovely feature to have; I really miss it (since we had it in the Eclipse version). Thanks both for putting your time into this.