Skip to content

Commit 0f14cde

Browse files
authored
fix(language-service): reinstate the completion for modifiers (#4639)
1 parent 0c0ed2a commit 0f14cde

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

packages/language-service/lib/plugins/vue-template.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,15 @@ export function create(
159159
return;
160160
}
161161

162-
if (sourceScript?.generated?.root instanceof VueVirtualCode) {
163-
await afterHtmlCompletion(
164-
htmlComplete,
165-
context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot)
166-
);
162+
if (sourceScript?.generated) {
163+
const virtualCode = sourceScript.generated.embeddedCodes.get('template');
164+
if (virtualCode) {
165+
const embeddedDocumentUri = context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id);
166+
afterHtmlCompletion(
167+
htmlComplete,
168+
context.documents.get(embeddedDocumentUri, virtualCode.languageId, virtualCode.snapshot)
169+
);
170+
}
167171
}
168172

169173
return htmlComplete;
@@ -660,9 +664,9 @@ export function create(
660664
};
661665
}
662666

663-
function afterHtmlCompletion(completionList: vscode.CompletionList, sourceDocument: TextDocument) {
667+
function afterHtmlCompletion(completionList: vscode.CompletionList, document: TextDocument) {
664668

665-
const replacement = getReplacement(completionList, sourceDocument);
669+
const replacement = getReplacement(completionList, document);
666670

667671
if (replacement) {
668672

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script lang="ts" setup>
2+
</script>
3+
4+
<template>
5+
<div @click. />
6+
<!-- ^complete: capture -->
7+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script lang="ts" setup>
2+
</script>
3+
4+
<template>
5+
<div @click.capture />
6+
<!-- ^complete: capture -->
7+
</template>

0 commit comments

Comments
 (0)