Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions extensions/typescript-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,12 @@
"tags": [
"experimental"
]
},
"js/ts.hover.maximumLength": {
"type": "number",
"default": 500,
"description": "%configuration.hover.maximumLength%",
"scope": "resource"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions extensions/typescript-language-features/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
"configuration.tsserver.nodePath": "Run TS Server on a custom Node installation. This can be a path to a Node executable, or 'node' if you want VS Code to detect a Node installation.",
"configuration.updateImportsOnPaste": "Automatically update imports when pasting code. Requires TypeScript 5.6+.",
"configuration.expandableHover": "Enable expanding/contracting the hover to reveal more/less information from the TS server. Requires TypeScript 5.9+.",
"configuration.hover.maximumLength": "The maximum number of characters in a hover. If the hover is longer than this, it will be truncated. Requires TypeScript 5.9+.",
"walkthroughs.nodejsWelcome.title": "Get started with JavaScript and Node.js",
"walkthroughs.nodejsWelcome.description": "Make the most of Visual Studio Code's first-class JavaScript experience.",
"walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.title": "Install Node.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ export default class FileConfigurationManager extends Disposable {
includeCompletionsForModuleExports: config.get<boolean>('suggest.autoImports'),
...getInlayHintsPreferences(config),
...this.getOrganizeImportsPreferences(preferencesConfig),
// @ts-expect-error until TS 5.9
maximumHoverLength: this.getMaximumHoverLength(document),
};

return preferences;
Expand Down Expand Up @@ -257,6 +259,16 @@ export default class FileConfigurationManager extends Disposable {
} : {}),
};
}


private getMaximumHoverLength(document: vscode.TextDocument): number {
const defaultMaxLength = 500;
const maximumHoverLength = vscode.workspace.getConfiguration('js/ts', document).get<number>('hover.maximumLength', defaultMaxLength);
if (!Number.isSafeInteger(maximumHoverLength) || maximumHoverLength <= 0) {
return defaultMaxLength;
}
return maximumHoverLength;
}
}

function withDefaultAsUndefined<T, O extends T>(value: T, def: O): Exclude<T, O> | undefined {
Expand Down
Loading