mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
add SymbolTag, make tag a propertiy, #23927
This commit is contained in:
@@ -330,7 +330,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
return {
|
||||
label: data.a,
|
||||
kind: data.b,
|
||||
kindTags: data.n,
|
||||
tags: data.n,
|
||||
detail: data.c,
|
||||
documentation: data.d,
|
||||
sortText: data.e,
|
||||
|
||||
@@ -808,7 +808,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
CommentMode: extHostTypes.CommentMode,
|
||||
CompletionItem: extHostTypes.CompletionItem,
|
||||
CompletionItemKind: extHostTypes.CompletionItemKind,
|
||||
CompletionItemKindTag: extHostTypes.CompletionItemKindTag,
|
||||
CompletionItemTag: extHostTypes.CompletionItemTag,
|
||||
CompletionList: extHostTypes.CompletionList,
|
||||
CompletionTriggerKind: extHostTypes.CompletionTriggerKind,
|
||||
ConfigurationTarget: extHostTypes.ConfigurationTarget,
|
||||
@@ -863,6 +863,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
StatusBarAlignment: extHostTypes.StatusBarAlignment,
|
||||
SymbolInformation: extHostTypes.SymbolInformation,
|
||||
SymbolKind: extHostTypes.SymbolKind,
|
||||
SymbolTag: extHostTypes.SymbolTag,
|
||||
Task: extHostTypes.Task,
|
||||
Task2: extHostTypes.Task,
|
||||
TaskGroup: extHostTypes.TaskGroup,
|
||||
|
||||
@@ -935,7 +935,7 @@ export interface ISuggestDataDto {
|
||||
k/* commitCharacters */?: string[];
|
||||
l/* additionalTextEdits */?: ISingleEditOperation[];
|
||||
m/* command */?: modes.Command;
|
||||
n/* kindModifier */?: modes.CompletionItemKindTag[];
|
||||
n/* kindModifier */?: modes.CompletionItemTag[];
|
||||
// not-standard
|
||||
x?: ChainedCacheId;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class DocumentSymbolAdapter {
|
||||
const element = <modes.DocumentSymbol>{
|
||||
name: info.name || '!!MISSING: name!!',
|
||||
kind: typeConvert.SymbolKind.from(info.kind),
|
||||
kindTags: [],
|
||||
tags: [],
|
||||
detail: undefined!, // Strict null override — avoid changing behavior
|
||||
containerName: info.containerName,
|
||||
range: typeConvert.Range.from(info.location.range),
|
||||
@@ -728,6 +728,7 @@ class SuggestAdapter {
|
||||
//
|
||||
a: item.label,
|
||||
b: typeConvert.CompletionItemKind.from(item.kind),
|
||||
n: item.tags && item.tags.map(typeConvert.CompletionItemTag.from),
|
||||
c: item.detail,
|
||||
d: typeof item.documentation === 'undefined' ? undefined : typeConvert.MarkdownString.fromStrict(item.documentation),
|
||||
e: item.sortText,
|
||||
@@ -739,12 +740,6 @@ class SuggestAdapter {
|
||||
m: this._commands.toInternal(item.command, disposables),
|
||||
};
|
||||
|
||||
// kind2
|
||||
if (typeof item.kind2 === 'object') {
|
||||
result.b = typeConvert.CompletionItemKind.from(item.kind2.kind);
|
||||
result.n = item.kind2.tags.map(typeConvert.CompletionItemKindTag.from);
|
||||
}
|
||||
|
||||
// 'insertText'-logic
|
||||
if (item.textEdit) {
|
||||
result.h = item.textEdit.newText;
|
||||
|
||||
@@ -28,7 +28,7 @@ import * as marked from 'vs/base/common/marked/marked';
|
||||
import { parse } from 'vs/base/common/marshalling';
|
||||
import { cloneAndChange } from 'vs/base/common/objects';
|
||||
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export interface PositionLike {
|
||||
@@ -556,6 +556,21 @@ export namespace SymbolKind {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace SymbolTag {
|
||||
|
||||
export function from(kind: types.SymbolTag): modes.SymbolTag {
|
||||
switch (kind) {
|
||||
case types.SymbolTag.Deprecated: return modes.SymbolTag.Deprecated;
|
||||
}
|
||||
}
|
||||
|
||||
export function to(kind: modes.SymbolTag): types.SymbolTag {
|
||||
switch (kind) {
|
||||
case modes.SymbolTag.Deprecated: return types.SymbolTag.Deprecated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace WorkspaceSymbol {
|
||||
export function from(info: vscode.SymbolInformation): search.IWorkspaceSymbol {
|
||||
return <search.IWorkspaceSymbol>{
|
||||
@@ -583,7 +598,7 @@ export namespace DocumentSymbol {
|
||||
range: Range.from(info.range),
|
||||
selectionRange: Range.from(info.selectionRange),
|
||||
kind: SymbolKind.from(info.kind),
|
||||
kindTags: []
|
||||
tags: info.tags ? info.tags.map(SymbolTag.from) : []
|
||||
};
|
||||
if (info.children) {
|
||||
result.children = info.children.map(from);
|
||||
@@ -598,6 +613,9 @@ export namespace DocumentSymbol {
|
||||
Range.to(info.range),
|
||||
Range.to(info.selectionRange),
|
||||
);
|
||||
if (isNonEmptyArray(info.tags)) {
|
||||
result.tags = info.tags.map(SymbolTag.to);
|
||||
}
|
||||
if (info.children) {
|
||||
result.children = info.children.map(to) as any;
|
||||
}
|
||||
@@ -682,17 +700,17 @@ export namespace CompletionContext {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace CompletionItemKindTag {
|
||||
export namespace CompletionItemTag {
|
||||
|
||||
export function from(kind: types.CompletionItemKindTag): modes.CompletionItemKindTag {
|
||||
export function from(kind: types.CompletionItemTag): modes.CompletionItemTag {
|
||||
switch (kind) {
|
||||
case types.CompletionItemKindTag.Deprecated: return modes.CompletionItemKindTag.Deprecated;
|
||||
case types.CompletionItemTag.Deprecated: return modes.CompletionItemTag.Deprecated;
|
||||
}
|
||||
}
|
||||
|
||||
export function to(kind: modes.CompletionItemKindTag): types.CompletionItemKindTag {
|
||||
export function to(kind: modes.CompletionItemTag): types.CompletionItemTag {
|
||||
switch (kind) {
|
||||
case modes.CompletionItemKindTag.Deprecated: return types.CompletionItemKindTag.Deprecated;
|
||||
case modes.CompletionItemTag.Deprecated: return types.CompletionItemTag.Deprecated;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -768,6 +786,7 @@ export namespace CompletionItem {
|
||||
const result = new types.CompletionItem(suggestion.label);
|
||||
result.insertText = suggestion.insertText;
|
||||
result.kind = CompletionItemKind.to(suggestion.kind);
|
||||
result.tags = suggestion.tags && suggestion.tags.map(CompletionItemTag.to);
|
||||
result.detail = suggestion.detail;
|
||||
result.documentation = htmlContent.isMarkdownString(suggestion.documentation) ? MarkdownString.to(suggestion.documentation) : suggestion.documentation;
|
||||
result.sortText = suggestion.sortText;
|
||||
|
||||
@@ -979,6 +979,10 @@ export enum SymbolKind {
|
||||
TypeParameter = 25
|
||||
}
|
||||
|
||||
export enum SymbolTag {
|
||||
Deprecated = 1,
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SymbolInformation {
|
||||
|
||||
@@ -1041,6 +1045,7 @@ export class DocumentSymbol {
|
||||
name: string;
|
||||
detail: string;
|
||||
kind: SymbolKind;
|
||||
tags?: SymbolTag[];
|
||||
range: Range;
|
||||
selectionRange: Range;
|
||||
children: DocumentSymbol[];
|
||||
@@ -1308,7 +1313,7 @@ export enum CompletionItemKind {
|
||||
TypeParameter = 24
|
||||
}
|
||||
|
||||
export enum CompletionItemKindTag {
|
||||
export enum CompletionItemTag {
|
||||
Deprecated = 1,
|
||||
}
|
||||
|
||||
@@ -1317,7 +1322,7 @@ export class CompletionItem implements vscode.CompletionItem {
|
||||
|
||||
label: string;
|
||||
kind?: CompletionItemKind;
|
||||
kind2?: CompletionItemKind | { kind: CompletionItemKind, tags: CompletionItemKindTag[] };
|
||||
tags?: CompletionItemTag[];
|
||||
detail?: string;
|
||||
documentation?: string | MarkdownString;
|
||||
sortText?: string;
|
||||
|
||||
Reference in New Issue
Block a user