Skip to content

Multiple improvements to Quick Info#2627

Merged
jakebailey merged 8 commits intomainfrom
fix-2599
Feb 1, 2026
Merged

Multiple improvements to Quick Info#2627
jakebailey merged 8 commits intomainfrom
fix-2599

Conversation

@ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Jan 31, 2026

Changes in this PR:

  • When an overload signature has no JSDoc, Quick Info now displays JSDoc from the first overload.
  • Quick Info uses getMeaningOfLocation to determine what symbol meanings to display (value, type, or namespace, or all).
  • Fixes a translation bug in getMeaningOfLocation.
  • Hovering over this would sometimes display no Quick Info or a wrong type.

Fixes #2599.

Copilot AI review requested due to automatic review settings January 31, 2026 21:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getMeaningFromLocation for 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 so this (including in typeof 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.

@ahejlsberg ahejlsberg enabled auto-merge February 1, 2026 03:27
@ahejlsberg ahejlsberg added this pull request to the merge queue Feb 1, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 1, 2026
@jakebailey jakebailey added this pull request to the merge queue Feb 1, 2026
@jakebailey
Copy link
Member

Failure is a test flake I believe #2628 fixes

Merged via the queue into main with commit 801590b Feb 1, 2026
21 checks passed
@jakebailey jakebailey deleted the fix-2599 branch February 1, 2026 06:20
@tats-u
Copy link

tats-u commented Feb 2, 2026

This change probably introduced an regression that the JSDoc of imported functions are not displayed.

(state.ts is at "Steps to reproduce" in #2599)

import { getState,setState } from "./state.ts";

console.log(getState());
setState(5);
console.log(getState());
setState((prev) => prev * prev);
console.log(getState());

tsconfig.json:

{
  // 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 getState in the above TS code after saving 3 files in the same directory with package.json with "type": "module".

Extension v0.20260131.1 → OK

image

v0.20260201.1 → Fails

image

@ahejlsberg
Copy link
Member Author

@tats-u Yeah, there's an issue with carrying forward JSDoc through imported aliases. I'll have a fix up soon.

Copilot AI pushed a commit that referenced this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSDoc for overloads and implementation is not displayed

4 participants