Skip to content

Commit 75e6b12

Browse files
authored
Adds args to editor.action.inlineSuggest.trigger to allow triggering a specific provider (microsoft#272724)
* Adds args to editor.action.inlineSuggest.trigger to allow triggering a specific provider * Fixes CI
1 parent d62af7e commit 75e6b12

File tree

6 files changed

+527
-19
lines changed

6 files changed

+527
-19
lines changed

src/vs/base/common/arrays.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,22 @@ export function mapArrayOrNot<T, U>(items: T | T[], fn: (_: T) => U): U | U[] {
563563
fn(items);
564564
}
565565

566+
export function mapFilter<T, U>(array: ReadonlyArray<T>, fn: (t: T) => U | undefined): U[] {
567+
const result: U[] = [];
568+
for (const item of array) {
569+
const mapped = fn(item);
570+
if (mapped !== undefined) {
571+
result.push(mapped);
572+
}
573+
}
574+
return result;
575+
}
576+
577+
export function withoutDuplicates<T>(array: ReadonlyArray<T>): T[] {
578+
const s = new Set(array);
579+
return Array.from(s);
580+
}
581+
566582
export function asArray<T>(x: T | T[]): T[];
567583
export function asArray<T>(x: T | readonly T[]): readonly T[];
568584
export function asArray<T>(x: T | T[]): T[] {

0 commit comments

Comments
 (0)