diff --git a/editors/vscode/src/extension.shared.ts b/editors/vscode/src/extension.shared.ts index 10fe754cb..1615a8d1a 100644 --- a/editors/vscode/src/extension.shared.ts +++ b/editors/vscode/src/extension.shared.ts @@ -133,8 +133,8 @@ export async function tinymistActivate( export async function tinymistDeactivate( trait: Pick, ): Promise { - for (const [condition, deactivate] of trait.activateTable()) { - if (condition) { + for (const [condition, _, deactivate] of trait.activateTable()) { + if (deactivate && condition) { deactivate(tinymist.context); } } diff --git a/editors/vscode/src/test/e2e/simple-docs.test.ts b/editors/vscode/src/test/e2e/simple-docs.test.ts index 86da3b8c4..a807b3f9e 100644 --- a/editors/vscode/src/test/e2e/simple-docs.test.ts +++ b/editors/vscode/src/test/e2e/simple-docs.test.ts @@ -106,5 +106,16 @@ export async function getTests(ctx: Context) { // close the editor await vscode.commands.executeCommand("workbench.action.closeActiveEditor"); }); + + suite.addTest("restart server", async () => { + const _mainTyp = await ctx.openDocument( + vscode.Uri.joinPath(workspaceUri, "completion-base.typ"), + ); + + await vscode.commands.executeCommand("tinymist.restartServer"); + + // close the editor + await vscode.commands.executeCommand("workbench.action.closeActiveEditor"); + }); }); }