Skip to content

Commit

Permalink
fix: cannot preview vite app path with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Nov 29, 2022
1 parent 6878126 commit b6c99d4
Showing 1 changed file with 1 addition and 5 deletions.
Expand Up @@ -35,7 +35,6 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan

let connection: ReturnType<typeof preview.createPreviewConnection> | undefined;
let highlightDomElements = true;
const onDidChangeCodeLensesEmmiter = new vscode.EventEmitter<void>();

const previewTerminal = vscode.window.terminals.find(terminal => terminal.name.startsWith('volar-preview:'));
if (previewTerminal) {
Expand All @@ -47,7 +46,6 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan
return 'vscode://files:/' + fileName;
},
});
onDidChangeCodeLensesEmmiter.fire();
statusBar.text = 'Preview Port: ' + previewTerminal.name.split(':')[1];
statusBar.show();
}
Expand All @@ -61,7 +59,6 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan
return 'vscode://files:/' + fileName;
},
});
onDidChangeCodeLensesEmmiter.fire();
statusBar.text = 'Preview Port: ' + e.name.split(':')[1];
statusBar.show();
}
Expand All @@ -70,7 +67,6 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan
if (e.name.startsWith('volar-preview:')) {
connection?.stop();
connection = undefined;
onDidChangeCodeLensesEmmiter.fire();
statusBar.hide();
}
});
Expand Down Expand Up @@ -522,7 +518,7 @@ export async function register(context: vscode.ExtensionContext, client: BaseLan
}

const terminal = vscode.window.createTerminal('volar-preview:' + port);
terminal.sendText(`cd ${viteDir}`);
terminal.sendText(`cd ${JSON.stringify(viteDir)}`);
terminal.sendText(script);

return {
Expand Down

0 comments on commit b6c99d4

Please sign in to comment.