Files
Jiwon ChoiandGitHub 26824378a6 [ts-plugin] Preserve TypeScript quick info metadata (#95863)
### Why?

VS Code passes a maximum hover length and verbosity level to
TypeScript's `getQuickInfoAtPosition` API when a user expands a hover.
The Next.js TypeScript plugin intercepted that call and forwarded the
file name and position, dropping the remaining arguments. The plugin
also replaced TypeScript's `QuickInfo` object when it added config
documentation, which discarded native fields such as
`canIncreaseVerbosityLevel`. As a result, hovers for Next.js config
exports could not expand and lost native type information.

This supersedes #86290 with a narrower behavior change. The plugin
preserves native `QuickInfo` when it adds documentation to valid config
values and config identifiers. Invalid config values keep the existing
synthesized override, and hovers inside function initializers retain
TypeScript's existing behavior.

x-ref:
https://github.com/microsoft/vscode/issues/232685#issuecomment-3484167019

| Before | After |
|--------|-------|
| <img width="1656" height="390" alt="Config hover without expandable
metadata"
src="https://github.com/user-attachments/assets/ed39a851-7096-448b-bffe-55c5320c1713"
/> | <img width="1668" height="384" alt="Config hover with expandable
metadata"
src="https://github.com/user-attachments/assets/0a3a0cbc-5c75-4b6f-90fc-bbcef028d06b"
/> |

### How?

The plugin forwards all QuickInfo arguments to TypeScript and passes the
native result into the config hover rules. For valid config values and
identifiers, those rules copy the native `QuickInfo` fields and append
the Next.js documentation. They synthesize the existing fallback when
TypeScript returns no QuickInfo.

Focused tests cover argument forwarding, metadata preservation, missing
native QuickInfo, invalid config values, and function config boundaries.

### Test plan

Open a minimal Next.js app in Cursor with workspace TypeScript 6.0.2 and
the package built from this PR. Hover `export const metadata: Metadata`,
then select the expansion control. The hover expands from `Metadata` to
its full property type while the Next.js config documentation and link
remain visible.

<!-- NEXT_JS_LLM -->
2026-07-24 11:54:15 +02:00
..

typescript-plugin fixture

This fixture is used to test the TypeScript plugin. The plugin only applies to VSCode so manual testing in VSCode is required.

Getting started

  1. Install the dependencies with pnpm install
  2. Open any TypeScript file of this fixture in VSCode
  3. Change TypeScript version to use Workspace version (see https://nextjs.org/docs/app/api-reference/config/typescript#typescript-plugin)

Tests

Client component prop serialization

app/client.tsx#ClientComponent has props that can and can't be serialized. Ensure the current comments still describe the observed behavior.

app/error.tsx#Error and app/global-error.tsx#GlobalError have reset and retry props that should be excluded from the serialization check.

Client Boundary

  • client-boundary/app/non-serializable-action-props.tsx has examples of Server Action props that can't be serialized, which is allowed.
  • client-boundary/app/non-serializable-props.tsx has examples of props that can't be serialized.
  • client-boundary/app/serializable-props.tsx has examples of props that can be serialized.

Metadata

  • metadata/app/metadata/completion has examples of metadata and generateMetadata completions.
  • metadata/app/metadata/missing-type-warning has examples of metadata and generateMetadata missing type warnings.
  • metadata/app/metadata/client has examples of metadata and generateMetadata not allowed in a client component.