Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions packages/monaco/src/browser/monaco-snippet-suggest-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class MonacoSnippetSuggestProvider implements monaco.languages.Completion
if (Array.isArray(body)) {
body = body.join('\n');
}
if (typeof prefix !== 'string' || typeof body !== 'string') {
if (typeof body !== 'string') {
return;
}
const scopes: string[] = [];
Expand All @@ -235,16 +235,31 @@ export class MonacoSnippetSuggestProvider implements monaco.languages.Completion
}
}
}
toDispose.push(
this.push({
scopes,
name,
prefix,
description,
body,
source,
}),
);
if (Array.isArray(prefix)) {
for (const key of prefix) {
toDispose.push(
this.push({
scopes,
name,
prefix: key,
description,
body,
source,
}),
);
}
} else {
toDispose.push(
this.push({
scopes,
name,
prefix,
description,
body,
source,
}),
);
}
});

return toDispose;
Expand Down Expand Up @@ -303,7 +318,7 @@ export interface JsonSerializedSnippets {
export interface JsonSerializedSnippet {
body: string | string[];
scope: string;
prefix: string;
prefix: string | string[];
description: string;
}
export namespace JsonSerializedSnippet {
Expand Down