haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

`hls-notes-plugin` could offer completions and help creating Notes

Open fendor opened this issue 1 month ago • 4 comments

hls-notes-plugin could offer completions for Note references, e.g. when I am typing in a comment context:

-- See Note [

we could offer all the known Notes here. This would make it even easier to reference notes without too much thinking.

Similarly, when creating a Note, we might want to help the user write the note as it is currently an undocumented specification used by GHC. However, I don't know yet how this should look like, just writing down the idea for now.

fendor avatar Nov 24 '25 16:11 fendor

cc @jvanbruegge, what do you think about this feature request?

This could be a good first issue for new contributors as well, and I am proposing it as a good issue for hackathons.

fendor avatar Nov 25 '25 08:11 fendor

Yeah, the completion for existing notes is a definitely a good idea, and for the other thing it maybe could suggest a snippet?

jvanbruegge avatar Nov 25 '25 10:11 jvanbruegge

I think the snippets could work but it is a bit tricky, as the number of ~ depend on the lenght of the name, right?

E.g.

-- Note [${1:note name}]
-- ~~~~~~~~~~~~~~~ <- How many of those?

Or is the plugin flexible enough to work with, let's say at least 3 ~, but it doesn't need to match exactly the length of the note title?

fendor avatar Nov 25 '25 10:11 fendor

The latter, and this is actually what GHC does as well. IIRC it is three tildes

jvanbruegge avatar Nov 25 '25 10:11 jvanbruegge