Conversation
|
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a user preference to configure the maximum truncation length for hover quickinfo, decoupling hover truncation from the diagnostic-only behavior controlled by the “noErrorTruncation” compiler option. Key changes include updating the signatures of quickinfo‐related functions across the codebase (including services, compiler utilities, and tests), adding a new default hover maximum length, and adjusting tests to verify the updated truncation output.
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cases/fourslash/quickinfoVerbosityTruncation*.ts | Added/updated tests to include the maximum truncation length parameter in quickinfo baseline verification |
| tests/cases/fourslash/quickInfoCanBeTruncated.ts | Updated expected quickinfo output for long union types reflecting expanded truncation behavior |
| src/services/utilities.ts | Updated display part writer creation to cache based on the new maximumLength parameter |
| src/services/types.ts | Modified getQuickInfoAtPosition API to include the new maximumLength parameter |
| src/services/symbolDisplay.ts | Propagated maximumLength parameter to type/symbol formatting functions |
| src/services/services.ts, src/server/session.ts | Updated quickinfo function calls to appropriately pass the new maximumLength value |
| src/harness/* | Adjusted fourslash harness functions to support maximum hover length configuration |
| src/compiler/utilities.ts | Defined defaultHoverMaximumTruncationLength and updated file emit utilities |
| src/compiler/types.ts | Updated internal signature and type formatting functions to support the new maximumLength parameter |
Files not reviewed (2)
- tests/baselines/reference/quickinfoVerbosityToplevelTruncation1.baseline: Language not supported
- tests/baselines/reference/quickinfoVerbosityTruncation1.baseline: Language not supported
Comments suppressed due to low confidence (2)
src/services/types.ts:585
- Ensure that the overloads for getQuickInfoAtPosition remain backward compatible by properly handling the new maximumLength parameter in both the public and internal signatures.
getQuickInfoAtPosition(fileName: string, position: number, maximumLength?: number, verbosityLevel?: number): QuickInfo | undefined;
src/compiler/types.ts:5187
- Confirm that adding the maximumLength parameter in writeSignature (and related functions such as writeType) integrates smoothly with the existing type formatting logic and does not alter legacy behavior unexpectedly.
writeSignature(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, writer?: EmitTextWriter, maximumLength?: number, verbosityLevel?: number, out?: WriterContextOut): string;
|
YAAAY!!!! 🎉🎉 |
|
Legendary!!! Thank you so much! 🔥 |
|
thanks ! |
Fixes #35601.
Fixes #26238.
This PR adds a user preference for configuring the maximum truncation length of a quickinfo/hover text.
Note that this only affects truncation during hover. Truncation during everything else still uses the same defaults.
This also fixes #26238 because we now always provide a truncation length to quickinfo that is independent from the compiler option
noErrorTruncation.I think the intention of
noErrorTruncationwas always to enable/disable truncation in diagnostics, but incidentally it affected everything that happened to usetypeToString.vscode PR: 248181
Note:
This and the vscode PRs set the maximum hover length to 500 by default. The previous default was 160.
This is almost a random number based on my experience of using expandable hover and feeling that 160 is way too low.