提交 3762f0f7 编写于 作者: J Johannes Rieken

warn about bogous snippets only once per extension, #36796

上级 ad8b83ef
...@@ -182,18 +182,22 @@ class SnippetsService implements ISnippetsService { ...@@ -182,18 +182,22 @@ class SnippetsService implements ISnippetsService {
return Promise.all(pending.map(([extension, filepath]) => { return Promise.all(pending.map(([extension, filepath]) => {
return SnippetFile.fromFile(filepath, extension.description.displayName || extension.description.name, true).then(file => { return SnippetFile.fromFile(filepath, extension.description.displayName || extension.description.name, true).then(file => {
let hasBogousSnippets = false;
for (const snippet of file.data) { for (const snippet of file.data) {
snippets.push(snippet); snippets.push(snippet);
bucket.push(snippet); bucket.push(snippet);
if (snippet.isBogous) { hasBogousSnippets = hasBogousSnippets || 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.", // warn about bad tabstop/variable usage
snippet.name 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 => { }, err => {
...@@ -204,7 +208,9 @@ class SnippetsService implements ISnippetsService { ...@@ -204,7 +208,9 @@ class SnippetsService implements ISnippetsService {
filepath filepath
)); ));
}); });
})); })).then(() => {
});
} else { } else {
return undefined; return undefined;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册