From 3762f0f759736b1e409c855298a38bead117c805 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 25 Oct 2017 18:13:16 +0200 Subject: [PATCH] warn about bogous snippets only once per extension, #36796 --- .../electron-browser/snippetsService.ts | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts b/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts index 4532acc8db9..347fd520860 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts @@ -182,18 +182,22 @@ class SnippetsService implements ISnippetsService { return Promise.all(pending.map(([extension, filepath]) => { return SnippetFile.fromFile(filepath, extension.description.displayName || extension.description.name, true).then(file => { + let hasBogousSnippets = false; for (const snippet of file.data) { snippets.push(snippet); bucket.push(snippet); - if (snippet.isBogous) { - // warn about bad tabstop/variable usage - extension.collector.warn(localize( - 'badVariableUse', - "The \"{0}\"-snippet very likely confuses snippet-variables and snippet-placeholders. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details.", - snippet.name - )); - } + hasBogousSnippets = hasBogousSnippets || snippet.isBogous; + + } + + // warn about bad tabstop/variable usage + if (hasBogousSnippets) { + extension.collector.warn(localize( + 'badVariableUse', + "One or more snippets from the extension '{0}' very likely confuse snippet-variables and snippet-placeholders (see https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details)", + extension.description.name + )); } }, err => { @@ -204,7 +208,9 @@ class SnippetsService implements ISnippetsService { filepath )); }); - })); + })).then(() => { + + }); } else { return undefined; -- GitLab