diff --git a/extensions/typescript-language-features/package.json b/extensions/typescript-language-features/package.json index b3b4db80976..c0d14ee761a 100644 --- a/extensions/typescript-language-features/package.json +++ b/extensions/typescript-language-features/package.json @@ -481,17 +481,11 @@ "experimental" ] }, - "typescript.maximumHoverLength": { + "js/ts.hover.maximumLength": { "type": "number", "default": 500, - "description": "%configuration.maximumHoverLength%", - "scope": "window" - }, - "javascript.maximumHoverLength": { - "type": "number", - "default": 500, - "description": "%configuration.maximumHoverLength%", - "scope": "window" + "description": "%configuration.hover.maximumLength%", + "scope": "resource" } } }, diff --git a/extensions/typescript-language-features/package.nls.json b/extensions/typescript-language-features/package.nls.json index c38e2a2c8c8..b6bfe27ee4c 100644 --- a/extensions/typescript-language-features/package.nls.json +++ b/extensions/typescript-language-features/package.nls.json @@ -231,7 +231,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.maximumHoverLength": "The maximum number of characters in a hover. If the hover is longer than this, it will be truncated. 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", diff --git a/extensions/typescript-language-features/src/languageFeatures/fileConfigurationManager.ts b/extensions/typescript-language-features/src/languageFeatures/fileConfigurationManager.ts index f0d98b8f404..bf70dcb19e5 100644 --- a/extensions/typescript-language-features/src/languageFeatures/fileConfigurationManager.ts +++ b/extensions/typescript-language-features/src/languageFeatures/fileConfigurationManager.ts @@ -209,7 +209,7 @@ export default class FileConfigurationManager extends Disposable { ...getInlayHintsPreferences(config), ...this.getOrganizeImportsPreferences(preferencesConfig), // @ts-expect-error until TS 5.9 - maximumHoverLength: this.getMaximumHoverLength(config), + maximumHoverLength: this.getMaximumHoverLength(document), }; return preferences; @@ -261,9 +261,9 @@ export default class FileConfigurationManager extends Disposable { } - private getMaximumHoverLength(configuration: vscode.WorkspaceConfiguration): number { + private getMaximumHoverLength(document: vscode.TextDocument): number { const defaultMaxLength = 500; - const maximumHoverLength = configuration.get('maximumHoverLength', defaultMaxLength); + const maximumHoverLength = vscode.workspace.getConfiguration('js/ts', document).get('maximumHoverLength', defaultMaxLength); if (!Number.isSafeInteger(maximumHoverLength) || maximumHoverLength <= 0) { return defaultMaxLength; }