fix: deactivate features correctly when restarting server (#1397)

This commit is contained in:
Myriad-Dreamin 2025-02-25 13:04:34 +08:00 committed by GitHub
parent 7abf925a10
commit 9b3ff2c319
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View file

@ -133,8 +133,8 @@ export async function tinymistActivate(
export async function tinymistDeactivate(
trait: Pick<TinymistTrait, "activateTable">,
): Promise<void> {
for (const [condition, deactivate] of trait.activateTable()) {
if (condition) {
for (const [condition, _, deactivate] of trait.activateTable()) {
if (deactivate && condition) {
deactivate(tinymist.context);
}
}

View file

@ -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");
});
});
}