-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
hls-notes-plugin: Initial implementation #3629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks cool! Maybe we can even do completions, although that would be ambitious :)
505ee39
to
b3ba0c4
Compare
Hi, I am trying to finish this up, but I have trouble making progress. The current approach does not work because it only takes into account the files that are open in the editor, which is really useless for jump-to-definition. So at ZuriHac after talking to Michael we decided to search for notes in all files on startup and save their locations. I've been trying to do that now, but I can't get HLS to give me all the files in the project. I found |
Your unit test needs to list all the modules in the arguments section of the |
Thanks, I will try that later |
adf129d
to
f0bc6ac
Compare
Ok, I think this is done now. The nix build failures do not seem related. I tried this on the GHC codebase and it does work: |
@michaelpj is there anything left to do here? |
d71c4ea
to
b9fb78f
Compare
I've rebased on the current master now, can this be merged now? @michaelpj |
The test failures are unrelated, the nix job fails because of fourmoulu, and the other test failures are twice in ghcide and once in hls-splice-plugin |
I restarted the testsuites, sorry for the delay in responses! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good to me! I only have requests for more documentation which it is currently lacking and some organisational stuff.
Please add this plugin to the CODEOWNERS file and add yourself as a maintainer.
Additionally, you should add the feature list to the documentation, https://github.com/haskell/haskell-language-server/blob/master/docs/features.md#jump-to-definition and add it is a new plugin to the plugin table https://github.com/haskell/haskell-language-server/blob/master/docs/support/plugin-support.md. If you plan to regularly maintain, add tier 2, otherwise tier 3, please.
a50e44d
to
f959f67
Compare
@fendor I had time now to fix this up. I added all the comments you requested and added myself to the codeowners file. |
I just tried the plugin on hls codebase and it works in some cases, but is broken in others. it gives error whenever I try to go to its definition within the same file (see gif illustrating the issue). EDIT: probably it's because this repo is not correctly using the "note definition" syntax (i.e. note title must be underscored with ~~~ and there should be no intermediate So multiline comment like this works
But this doesn't
You could potentially fix the notes across the codebase as part of this PR if you feel like it 😄 I'm just wondering if the error messages could be improved a bit to make the reason why note definition was not found more obvious (e.g. "Note definition (a comment of the form "{- Note [TITLE]\n~~~ ... -}") was not found"). |
I've addressed the review comments, also made the note format more liberal and improved the error message |
884c572
to
84a1b09
Compare
Also added a commit now that should make all notes in the hls codebase compliant with the plugin. Given that I made the format more liberal this only boiled down to adding underscores to a bunch of notes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Looks good to me 👍
afad717
to
abcf822
Compare
I've also rebased onto the current master now |
ba8e1a7
to
e2d3c2f
Compare
I've added a |
The regex did not allow windows line endings in note definitions
e2d3c2f
to
e8e72d1
Compare
Ok, I found the issue on windows: Line endings. The regex only allowed a single newline character, but on windows it's |
Restarted |
Great, CI is passing now. @fendor I have done the requested changes earlier already. |
I'll go ahead and close this. My motivation to rebase this again because it has been sitting so long is pretty much zero. |
A plugin to expand hls' jump-to-definition to work for GHC-style notes.
TODO: