提交 f7fe25dc 编写于 作者: J Johannes Rieken

use ReadonlyArray for tags, #50972

上级 8b0bc473
...@@ -8,14 +8,6 @@ import { CharCode } from 'vs/base/common/charCode'; ...@@ -8,14 +8,6 @@ import { CharCode } from 'vs/base/common/charCode';
import { Iterator, IteratorResult, FIN } from './iterator'; import { Iterator, IteratorResult, FIN } from './iterator';
export function fromArray<T>(array: readonly T[]): Set<T> {
const result = new Set<T>();
for (const element of array) {
result.add(element);
}
return result;
}
export function values<V = any>(set: Set<V>): V[]; export function values<V = any>(set: Set<V>): V[];
export function values<K = any, V = any>(map: Map<K, V>): V[]; export function values<K = any, V = any>(map: Map<K, V>): V[];
export function values<V>(forEachable: { forEach(callback: (value: V, ...more: any[]) => any): void }): V[] { export function values<V>(forEachable: { forEach(callback: (value: V, ...more: any[]) => any): void }): V[] {
......
...@@ -404,7 +404,7 @@ export interface CompletionItem { ...@@ -404,7 +404,7 @@ export interface CompletionItem {
* A modifier to the `kind` which affect how the item * A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout * is rendered, e.g. Deprecated is rendered with a strikeout
*/ */
kindTags?: Set<CompletionItemKindTag>; kindTags?: ReadonlyArray<CompletionItemKindTag>;
/** /**
* A human-readable string with additional information * A human-readable string with additional information
* about this item, like type or symbol information. * about this item, like type or symbol information.
...@@ -913,7 +913,7 @@ export interface DocumentSymbol { ...@@ -913,7 +913,7 @@ export interface DocumentSymbol {
name: string; name: string;
detail: string; detail: string;
kind: SymbolKind; kind: SymbolKind;
kindTags: SymbolKindTag[]; kindTags: ReadonlyArray<SymbolKindTag>;
containerName?: string; containerName?: string;
range: IRange; range: IRange;
selectionRange: IRange; selectionRange: IRange;
......
...@@ -193,7 +193,7 @@ class Renderer implements IListRenderer<CompletionItem, ISuggestionTemplateData> ...@@ -193,7 +193,7 @@ class Renderer implements IListRenderer<CompletionItem, ISuggestionTemplateData>
]; ];
} }
if (suggestion.kindTags && suggestion.kindTags.has(CompletionItemKindTag.Deprecated)) { if (suggestion.kindTags && suggestion.kindTags.indexOf(CompletionItemKindTag.Deprecated) >= 0) {
labelOptions.extraClasses = (labelOptions.extraClasses || []).concat(['deprecated']); labelOptions.extraClasses = (labelOptions.extraClasses || []).concat(['deprecated']);
labelOptions.matches = []; labelOptions.matches = [];
} }
......
...@@ -4822,7 +4822,7 @@ declare namespace monaco.languages { ...@@ -4822,7 +4822,7 @@ declare namespace monaco.languages {
* A modifier to the `kind` which affect how the item * A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout * is rendered, e.g. Deprecated is rendered with a strikeout
*/ */
kindTags?: Set<CompletionItemKindTag>; kindTags?: ReadonlyArray<CompletionItemKindTag>;
/** /**
* A human-readable string with additional information * A human-readable string with additional information
* about this item, like type or symbol information. * about this item, like type or symbol information.
...@@ -5240,7 +5240,7 @@ declare namespace monaco.languages { ...@@ -5240,7 +5240,7 @@ declare namespace monaco.languages {
name: string; name: string;
detail: string; detail: string;
kind: SymbolKind; kind: SymbolKind;
kindTags: SymbolKindTag[]; kindTags: ReadonlyArray<SymbolKindTag>;
containerName?: string; containerName?: string;
range: IRange; range: IRange;
selectionRange: IRange; selectionRange: IRange;
......
...@@ -21,7 +21,6 @@ import { Selection } from 'vs/editor/common/core/selection'; ...@@ -21,7 +21,6 @@ import { Selection } from 'vs/editor/common/core/selection';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import * as callh from 'vs/workbench/contrib/callHierarchy/common/callHierarchy'; import * as callh from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { mixin } from 'vs/base/common/objects'; import { mixin } from 'vs/base/common/objects';
import { fromArray } from 'vs/base/common/map';
@extHostNamedCustomer(MainContext.MainThreadLanguageFeatures) @extHostNamedCustomer(MainContext.MainThreadLanguageFeatures)
export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape { export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape {
...@@ -331,7 +330,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha ...@@ -331,7 +330,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
return { return {
label: data.a, label: data.a,
kind: data.b, kind: data.b,
kindTags: data.n && fromArray(data.n), kindTags: data.n,
detail: data.c, detail: data.c,
documentation: data.d, documentation: data.d,
sortText: data.e, sortText: data.e,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册