Skip to content

Commit

Permalink
add expandable hover experimental setting
Browse files Browse the repository at this point in the history
  • Loading branch information
gabritto committed Sep 23, 2024
1 parent a12778c commit ca8d20e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions extensions/typescript-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,15 @@
"tags": [
"experimental"
]
},
"typescript.experimental.expandableHover": {
"type": "boolean",
"default": false,
"description": "%configuration.expandableHover%",
"scope": "window",
"tags": [
"experimental"
]
}
}
},
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 @@ -237,6 +237,7 @@
"configuration.tsserver.web.typeAcquisition.enabled": "Enable/disable package acquisition on the web. This enables IntelliSense for imported packages. Requires `#typescript.tsserver.web.projectWideIntellisense.enabled#`. Currently not supported for Safari.",
"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": "(Experimental) Enable/disable expanding on hover.",
"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 @@ -33,8 +33,9 @@ class TypeScriptHoverProvider implements vscode.HoverProvider {
return undefined;
}

const enableExpandableHover = vscode.workspace.getConfiguration('typescript').get('experimental.expandableHover');
let verbosityLevel: number | undefined;
if (this.client.apiVersion.gte(API.v570)) {
if (enableExpandableHover && this.client.apiVersion.gte(API.v570)) {
verbosityLevel = Math.max(0, this.getPreviousLevel(context?.previousHover) + (context?.verbosityDelta ?? 0));
}
const args = { ...typeConverters.Position.toFileLocationRequestArgs(filepath, position), verbosityLevel };
Expand Down

0 comments on commit ca8d20e

Please # to comment.