Skip to content

Commit

Permalink
fix: emmet completion duplicate in template
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Apr 21, 2022
1 parent 5031e02 commit 608a959
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -146,6 +146,10 @@ export function register(context: LanguageServiceRuntimeContext) {
if (cache!.mainCompletion && (!plugin.complete.isAdditional || cache?.mainCompletion.documentUri !== sourceMap.mappedDocument.uri))
continue;

// avoid duplicate items with .vue and .vue.htmlx
if (plugin.complete.isAdditional && cache?.data.some(data => data.plugin === plugin))
continue;

const embeddedCompletionList = await plugin.complete?.on(sourceMap.mappedDocument, embeddedRange.start, completionContext);

if (!embeddedCompletionList || !embeddedCompletionList.items.length)
Expand Down Expand Up @@ -205,6 +209,10 @@ export function register(context: LanguageServiceRuntimeContext) {
if (cache.mainCompletion && (!plugin.complete.isAdditional || cache.mainCompletion.documentUri !== document.uri))
continue;

// avoid duplicate items with .vue and .vue.htmlx
if (plugin.complete.isAdditional && cache?.data.some(data => data.plugin === plugin))
continue;

const completionList = await plugin.complete?.on(document, position, completionContext);

if (!completionList || !completionList.items.length)
Expand Down

0 comments on commit 608a959

Please sign in to comment.