提交 6c7fe5b9 编写于 作者: R Ramya Achutha Rao

Dont repeat hex color suggestions in emmet Fixes #32232

上级 994bfe69
......@@ -194,6 +194,7 @@ function validateTextDocument(textDocument: TextDocument): void {
}
let cachedCompletionList: CompletionList;
const hexColorRegex = /^#[\d,a-f,A-F]{1,6}$/;
connection.onCompletion(textDocumentPosition => {
return runSafe(() => {
let document = documents.get(textDocumentPosition.textDocument.uri);
......@@ -223,6 +224,9 @@ connection.onCompletion(textDocumentPosition => {
const result = getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheets.get(document))!; /* TODO: remove ! once LS has null annotations */
if (emmetCompletionList && emmetCompletionList.items) {
cachedCompletionList = result;
if (emmetCompletionList.items.length && hexColorRegex.test(emmetCompletionList.items[0].label) && result.items.some(x => x.label === emmetCompletionList.items[0].label)) {
emmetCompletionList.items.shift();
}
return { isIncomplete: true, items: [...emmetCompletionList.items, ...result.items] };
}
return result;
......
......@@ -238,6 +238,7 @@ async function validateTextDocument(textDocument: TextDocument) {
}
let cachedCompletionList: CompletionList;
const hexColorRegex = /^#[\d,a-f,A-F]{1,6}$/;
connection.onCompletion(async textDocumentPosition => {
return runSafe(async () => {
let document = documents.get(textDocumentPosition.textDocument.uri);
......@@ -280,6 +281,9 @@ connection.onCompletion(async textDocumentPosition => {
let result = mode.doComplete(document, textDocumentPosition.position, settings);
if (emmetCompletionList && emmetCompletionList.items) {
cachedCompletionList = result;
if (emmetCompletionList.items.length && hexColorRegex.test(emmetCompletionList.items[0].label) && result.items.some(x => x.label === emmetCompletionList.items[0].label)) {
emmetCompletionList.items.shift();
}
return { isIncomplete: true, items: [...emmetCompletionList.items, ...result.items] };
}
return result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册