html-language-features: include JSDoc summary and tags in <script> hover#312585
Merged
aeschli merged 4 commits intoJun 1, 2026
Merged
Conversation
In doHover for JavaScript embedded in HTML <script> blocks, surface info.documentation (JSDoc summary) and info.tags (@param, @returns, etc.) alongside the existing info.displayParts signature. The hover now returns a MarkupContent markdown payload with the signature, description, and tag sections so HTML files get parity with .js/.ts hovers. Fixes microsoft#268776
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the HTML language server’s embedded-JavaScript hover behavior so that hover tooltips inside <script> blocks include JSDoc documentation (summary + tags) instead of showing only the symbol signature, bringing it closer to the JS/TS hover experience.
Changes:
- Enhance
javascriptMode.doHoverto includeinfo.documentationandinfo.tags, returning a markdown hover payload with signature + docs + tags. - Add regression tests that assert JSDoc summaries appear in hover results for a class and a method declared inside
<script>in an HTML document.
Show a summary per file
| File | Description |
|---|---|
| extensions/html-language-features/server/src/modes/javascriptMode.ts | Builds a markdown hover value combining signature, JSDoc summary, and formatted JSDoc tags for embedded JS/TS. |
| extensions/html-language-features/server/src/test/hover.test.ts | Adds coverage ensuring embedded <script> hover includes JSDoc summary text for class and method symbols. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
aeschli
approved these changes
Jun 1, 2026
Contributor
|
Thanks a lot! |
Yoyokrazy
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #268776
Summary
Hovering over a JavaScript class or method declared inside a
<script>block in an HTML file currently only shows the symbol's signature, not its JSDoc description or@param/@returnstags. The same symbol declared in a.js/.tsfile shows the full description. This PR brings the HTML embedded-JS hover to parity with the standalone JS/TS hover.Changes
extensions/html-language-features/server/src/modes/javascriptMode.ts— IndoHover, in addition to the existinginfo.displayPartssignature, surfaceinfo.documentation(the JSDoc summary) andinfo.tags(@param,@returns, etc.). The hover now returns aMarkupContentmarkdown payload with three sections (signature, description, tags) joined by blank lines. Two small helperstagToMarkdown/tagsToMarkdownare added, modeled after the equivalent helpers inextensions/typescript-language-features/src/languageFeatures/util/textRendering.ts.extensions/html-language-features/server/src/test/hover.test.ts— New regression test file with two cases: hover on a JSDoc'd class declared inside<script>, and hover on a JSDoc'd method. Both assert the description text is included in the hover. Confirmed the new tests fail without the fix and pass with it.How to test
<script>block, e.g.:Greeter(orgreet).class Greeter).@param/@returnstag information.hover.test.tsshould pass.