azdavis / millet

A language server for Standard ML.
https://azdavis.net/posts/millet
Apache License 2.0
210 stars 12 forks source link

Feature request: implement function docstring popup #13

Closed gnahtb closed 2 years ago

gnahtb commented 2 years ago

I notice that currently the language server doesn't support function docstring popups. If we look at other language servers, for example, Java, we see that if the user specifies some comments right on top of the function, when the user hovers over the function name, a popup showing the comments appears.

I think this feature is useful, considering that a lot of users usually write some comments about the function usage.

image

azdavis commented 2 years ago

Millet does support this, you just have to write the comment in a certain way: https://github.com/azdavis/millet/blob/main/docs/manual.md#doc-comments

gnahtb commented 2 years ago

Weirdly that doesn't work for me. Do I have to enable something in the extension settings? I'm running VSCode 1.71.2 on Windows and the Millet version is v0.3.10.

Also, I think it is nice if we can define some convention for our docstrings. For example, in the above screenshot, we see that the Java extension uses @param to denote the definition of a function parameter.

image

azdavis commented 2 years ago

Seems like hovering for doc works for everywhere except the def site itself. If you're hovering the def site itself, you have the comment right in front of you anyway, so that seems not too bad.

Screen Shot 2022-09-24 at 10 28 39 PM

As for conventions, 🤷 . You can use whatever style you want, as long as it's Markdown. There are other existing ML doc comment styles, but I just 'invented' one for the purposes of Millet.

gnahtb commented 2 years ago

I can work to improve the hovering for the def site if no one plans to do it. It will take me a lot of time since I'm unfamiliar with VSCode API, but this seems low-priority, so I hope it won't matter much.

azdavis commented 2 years ago

Closing this since the original issue itself (doc comments) is resolved. If you want to send a patch to implement hover for doc on the def site feel free to.