Skip to content

Fix hover documentation for intersected properties - #4646

Open
cuishuang wants to merge 1 commit into
microsoft:mainfrom
cuishuang:main
Open

Fix hover documentation for intersected properties#4646
cuishuang wants to merge 1 commit into
microsoft:mainfrom
cuishuang:main

Conversation

@cuishuang

@cuishuang cuishuang commented Jul 15, 2026

Copy link
Copy Markdown

Fixes microsoft/TypeScript#63640.

Synthetic intersection properties can have multiple declarations but no value declaration. Hover documentation previously only inspected the value declaration, causing the merged JSDoc to be lost.

This change falls back to gathering and deduplicating documentation from all symbol declarations and adds a regression test.

This change was developed with assistance from OpenAI Codex. I reviewed and understand the patch and will respond to review feedback.

Copilot AI review requested due to automatic review settings July 15, 2026 08:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes hover/QuickInfo documentation loss for synthetic intersection (and union) properties that have declarations but no value declaration by falling back to aggregating JSDoc from all symbol declarations, with a regression fourslash test.

Changes:

  • Refactors documentation collection into getDocumentationFromDeclarations (gather + dedupe across declarations).
  • Updates hover documentation retrieval to fall back to declaration-based docs when no info.declaration is available.
  • Adds a fourslash regression test asserting merged hover documentation for an A & B property.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/ls/jsdoc.go Extracts a helper to gather/dedupe documentation text across a provided declaration list.
internal/ls/hover.go Adds a hover fallback path to use aggregated docs when there is no value declaration (synthetic union/intersection properties).
internal/fourslash/tests/hoverIntersectionPropertyDocumentation_test.go Adds a regression test verifying merged hover docs for an intersection property.

@Andarist

Copy link
Copy Markdown
Contributor

this issue is already being fixed by my older PR: #3663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSDoc for properties of intersected types is no longer merged

4 participants