mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
support label details (#146270)
This commit is contained in:
committed by
GitHub
parent
a403b3bef9
commit
88e3d49156
@@ -59,7 +59,8 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
constructor(
|
||||
public readonly position: vscode.Position,
|
||||
public readonly document: vscode.TextDocument,
|
||||
public readonly tsEntry: Proto.CompletionEntry,
|
||||
// Intersection needed to avoid type error until TS 4.7.
|
||||
public readonly tsEntry: Proto.CompletionEntry & { labelDetails?: { detail?: string; description?: string } },
|
||||
private readonly completionContext: CompletionContext,
|
||||
public readonly metadata: any | undefined,
|
||||
client: ITypeScriptServiceClient,
|
||||
@@ -86,6 +87,10 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
this.label = { label: tsEntry.name, description: Previewer.plainWithLinks(sourceDisplay, client) };
|
||||
}
|
||||
|
||||
if (tsEntry.labelDetails) {
|
||||
this.label = { label: tsEntry.name, ...tsEntry.labelDetails };
|
||||
}
|
||||
|
||||
this.preselect = tsEntry.isRecommended;
|
||||
this.position = position;
|
||||
this.useCodeSnippet = completionContext.useCodeSnippetsOnMethodSuggest && (this.kind === vscode.CompletionItemKind.Function || this.kind === vscode.CompletionItemKind.Method);
|
||||
|
||||
@@ -189,6 +189,7 @@ export default class FileConfigurationManager extends Disposable {
|
||||
includeCompletionsWithClassMemberSnippets: config.get<boolean>('suggest.classMemberSnippets.enabled', true),
|
||||
// @ts-expect-error until 4.7
|
||||
includeCompletionsWithObjectLiteralMethodSnippets: config.get<boolean>('suggest.objectLiteralMethodSnippets.enabled', true),
|
||||
useLabelDetailsInCompletionEntries: true,
|
||||
allowIncompleteCompletions: true,
|
||||
displayPartsForJSDoc: true,
|
||||
...getInlayHintsPreferences(config),
|
||||
|
||||
Reference in New Issue
Block a user