Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens Quick Info behavior in the language server to better match upstream TypeScript, especially around overload JSDoc, symbol meaning (value/type/namespace) selection, and this handling, and aligns various fourslash baselines accordingly.
Changes:
- Fixes
getMeaningFromLocationfor internal import-equals declarations so value/type/namespace meanings match the intended semantics, which in turn fixes find-all-references and document-highlights around merged and import-equals symbols. - Reworks Quick Info formatting to select symbol meanings using
getMeaningFromLocation, improves alias rendering, and adds special handling sothis(including intypeof this) gets a correct type display. - Enhances JSDoc lookup to reuse the first overload’s JSDoc for other overloads/implementations and propagates that into Quick Info and signature help, updating fourslash Go tests and baselines to reflect the new behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc.diff | Removes now-unnecessary diff content after find-all-references behavior for merged declarations 8 matches the reference. |
| testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc | Restores reference markers for merged Foo.Bar declarations to match correct reference classification. |
| testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc.diff | Clears obsolete diff content once merged-declaration references 7 align with the submodule baseline. |
| testdata/baselines/reference/submodule/fourslash/findAllReferences/referencesForMergedDeclarations7.baseline.jsonc | Adjusts highlighted Bar references and import-equals usage to reflect corrected meaning-of-location. |
| testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc.diff | Drops diff content now that import-equals find-all-references behavior matches the upstream baseline. |
| testdata/baselines/reference/submodule/fourslash/findAllReferences/findAllRefsImportEquals.baseline.jsonc | Marks the exported q in namespace N as a reference target to align with corrected import-equals semantics. |
| testdata/baselines/reference/fourslash/signatureHelp/signatureHelpCommentsCommentParsing.baseline | Updates signature help textual and JSON sections so function/parameter JSDoc (fn f1 with number, about b) is surfaced correctly. |
| testdata/baselines/reference/fourslash/quickInfo/quickInfoOnThis5.baseline | Adjusts Quick Info expectations for this and typeof this so the shown type matches the enclosing object/parameter type instead of any or missing info. |
| testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsCommentParsing.baseline | Extends Quick Info comment baselines to include parameter and function JSDoc text, including formatted @param details. |
| testdata/baselines/reference/fourslash/documentHighlights/qualifiedName_import_declaration_with_variable_entity_names.baseline.jsonc | Ensures document highlights correctly include all occurrences of x in a module/variable-import scenario. |
| internal/ls/utilities.go | Fixes the import-equals branch in getMeaningFromLocation so qualified names on the right-hand side get SemanticMeaningAll only when appropriate, matching the documented semantics. |
| internal/ls/hover.go | Refactors Quick Info generation to use getMeaningFromLocation, handle aliases with a nesting-aware prefix, special-case this type display, and reuse JSDoc from the first overload for other signatures. |
| internal/fourslash/tests/gen/augmentedTypesModule2_test.go | Updates the Quick Info expectation for a merged function/namespace symbol so hovering the function name shows only the function signature, matching the new meaning-of-location behavior. |
|
Failure is a test flake I believe #2628 fixes |
|
This change probably introduced an regression that the JSDoc of imported functions are not displayed. ( import { getState,setState } from "./state.ts";
console.log(getState());
setState(5);
console.log(getState());
setState((prev) => prev * prev);
console.log(getState());
{
// Visit https://aka.ms/tsconfig to read more about this file
"compilerOptions": {
// File Layout
// "rootDir": "./src",
// "outDir": "./dist",
// Environment Settings
// See also https://aka.ms/tsconfig/module
"module": "nodenext",
"target": "esnext",
// "types": [],
// For nodejs:
"lib": ["esnext", "DOM"],
"types": ["node"],
// and npm install -D @types/node
// Other Outputs
"sourceMap": true,
"declaration": true,
"declarationMap": true,
// Stricter Typechecking Options
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
// Style Options
// "noImplicitReturns": true,
// "noImplicitOverride": true,
// "noUnusedLocals": true,
// "noUnusedParameters": true,
// "noFallthroughCasesInSwitch": true,
// "noPropertyAccessFromIndexSignature": true,
// Recommended Options
"strict": true,
"jsx": "react-jsx",
"verbatimModuleSyntax": true,
"isolatedModules": true,
"noUncheckedSideEffectImports": true,
"moduleDetection": "force",
"skipLibCheck": true,
"noEmit": true,
"erasableSyntaxOnly": true,
"allowImportingTsExtensions": true
}
}To reproduce: Hover Extension
|
|
@tats-u Yeah, there's an issue with carrying forward JSDoc through imported aliases. I'll have a fix up soon. |


Changes in this PR:
getMeaningOfLocationto determine what symbol meanings to display (value, type, or namespace, or all).getMeaningOfLocation.thiswould sometimes display no Quick Info or a wrong type.Fixes #2599.