feat(language-service): ✨ add rich hover alternatives#6066
Conversation
Because of a missing newline at the end of the descriptions, code blocks weren't properly closed and 'bled' into the rest of the hover documentation.
9344a7a to
17239db
Compare
17239db to
648547d
Compare
|
I think we can keep only the |
|
For the interface Props {
/**
* @description foo
* @default "..."
*/
foo?: string;
/**
* @deprecated
*/
bar?: boolean;
}This would make the output feel closer to how JS/TS developers already read and write type information, while still leaving room to present metadata in a structured way. This approach would also avoid the styling friction caused by rendering markdown text and code text together. |
I played around with that idea. The first version just wraps everything in interfaces, but keeps the default and prefixes ( The second version uses fully legal interfaces and the I kinda like For default I can see arguments for both sides. The one downside of I pushed my changes, if you wanna try it. The code needs some clean up; I will do that once we decided with which solution to move forward. |
|
I think using these template syntax specific characters to distinguish them is indeed a good idea, but I still lean toward using fully valid jsdoc to reduce potential cognitive friction. A few other minor changes:
|


Hello,
a while ago the Vue language tools got a new feature in form of rich hover documentation. This is a pretty useful feature, but because it is based on HTML it does not work in terminal editors like Neovim. I wanted to change that and created two possible alternatives (more on those variants below).
Notes
test-workspaceto test the different possibilities<child>and a<minimal>; I created the latter for screenshots and intend to delete it before mergeOpen points
onX) are moved into the event list@orv-onvue-template.tsfile is quite long, I opted for moving most of the logic concerning this component hover into a separate file to make it a bit easier to digestThe variants
1. Markdown
I originally started with the markdown version and ran into the challenge with VSCode that the descriptions were slightly closer to the following meta element than to the element they belonged to. This made it confusing to see for which meta the description would actually be, especially because we are used to description on top because of JSDoc. I did not find a way with pure Markdown to create more space, which is why I decided to indent the description via blockquote (
>).Screenshot VSCode
Details
Upsides:
strikethroughDownsides:
2. JSDoc
I then realized that Markdown supports code blocks, so I put everything into TS codeblock and added the descriptions as "JSDoc comments", which resulted in the second variant.
Screenshot VSCode
Resulting Markdown
Upsides:
@tagsare colored the same as in JSDocDownsides:
Conclusion
I personally have a light preference for the JSDoc version, because I think it puts a stronger emphasize on the meta information (name, type, default) instead of the description, which is what I want from this kind of documentation. To get the fully rendered description I can always open the hover docs for just that specific meta element.
But ultimately I think both variants are fine. I even asked my colleagues but there were proponents for both versions, so it might just come down to taste, which would be an argument to keep both and let the users decide themselves.