提交 007d692e 编写于 作者: J Johannes Rieken

fix #42530

上级 80fad3e1
......@@ -337,16 +337,19 @@ export class SnippetSuggestProvider implements ISuggestSupport {
}
// dismbiguate suggestions with same labels
let lastItem: SnippetSuggestion;
for (const item of suggestions.sort(SnippetSuggestion.compareByLabel)) {
if (lastItem && lastItem.label === item.label) {
// use the disambiguateLabel instead of the actual label
lastItem.label = localize('snippetSuggest.longLabel', "{0}, {1}", lastItem.label, lastItem.snippet.name);
item.label = localize('snippetSuggest.longLabel', "{0}, {1}", item.label, item.snippet.name);
suggestions.sort(SnippetSuggestion.compareByLabel);
for (let i = 0; i < suggestions.length; i++) {
let item = suggestions[i];
let to = i + 1;
for (; to < suggestions.length && item.label === suggestions[to].label; to++) {
suggestions[to].label = localize('snippetSuggest.longLabel', "{0}, {1}", suggestions[to].label, suggestions[to].snippet.name);
}
if (to > i + 1) {
suggestions[i].label = localize('snippetSuggest.longLabel', "{0}, {1}", suggestions[i].label, suggestions[i].snippet.name);
i = to;
}
lastItem = item;
}
return { suggestions };
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册