Skip to content

Commit

Permalink
use ReadonlyArray for tags, #50972
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Aug 23, 2019
1 parent 8b0bc47 commit f7fe25d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
8 changes: 0 additions & 8 deletions src/vs/base/common/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ import { CharCode } from 'vs/base/common/charCode';
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<K = any, V = any>(map: Map<K, V>): V[];
export function values<V>(forEachable: { forEach(callback: (value: V, ...more: any[]) => any): void }): V[] {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/common/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export interface CompletionItem {
* A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout
*/
kindTags?: Set<CompletionItemKindTag>;
kindTags?: ReadonlyArray<CompletionItemKindTag>;
/**
* A human-readable string with additional information
* about this item, like type or symbol information.
Expand Down Expand Up @@ -913,7 +913,7 @@ export interface DocumentSymbol {
name: string;
detail: string;
kind: SymbolKind;
kindTags: SymbolKindTag[];
kindTags: ReadonlyArray<SymbolKindTag>;
containerName?: string;
range: IRange;
selectionRange: IRange;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/suggest/suggestWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.matches = [];
}
Expand Down
4 changes: 2 additions & 2 deletions src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4822,7 +4822,7 @@ declare namespace monaco.languages {
* A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout
*/
kindTags?: Set<CompletionItemKindTag>;
kindTags?: ReadonlyArray<CompletionItemKindTag>;
/**
* A human-readable string with additional information
* about this item, like type or symbol information.
Expand Down Expand Up @@ -5240,7 +5240,7 @@ declare namespace monaco.languages {
name: string;
detail: string;
kind: SymbolKind;
kindTags: SymbolKindTag[];
kindTags: ReadonlyArray<SymbolKindTag>;
containerName?: string;
range: IRange;
selectionRange: IRange;
Expand Down
3 changes: 1 addition & 2 deletions src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Selection } from 'vs/editor/common/core/selection';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import * as callh from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { mixin } from 'vs/base/common/objects';
import { fromArray } from 'vs/base/common/map';

@extHostNamedCustomer(MainContext.MainThreadLanguageFeatures)
export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape {
Expand Down Expand Up @@ -331,7 +330,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
return {
label: data.a,
kind: data.b,
kindTags: data.n && fromArray(data.n),
kindTags: data.n,
detail: data.c,
documentation: data.d,
sortText: data.e,
Expand Down

0 comments on commit f7fe25d

Please sign in to comment.