Skip to content

Commit

Permalink
fix: should not send parseSfc request when preview server closed
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 6, 2023
1 parent 2b90545 commit 603629a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vue-language-tools/vscode-vue/src/features/preview.ts
Expand Up @@ -284,10 +284,10 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan
}

async function updateSelectionHighlights(textEditor: vscode.TextEditor) {
if (textEditor.document.languageId === 'vue' && highlightDomElements) {
if (connection && textEditor.document.languageId === 'vue' && highlightDomElements) {
const sfc = await getSfc(textEditor.document);
const offset = sfc.descriptor.template?.loc.start.offset ?? 0;
connection?.highlight(
connection.highlight(
textEditor.document.fileName,
textEditor.selections.map(selection => ({
start: textEditor.document.offsetAt(selection.start) - offset,
Expand Down

0 comments on commit 603629a

Please sign in to comment.