diff --git a/acumate-plugin/src/extension.ts b/acumate-plugin/src/extension.ts index 0bfe740..ef9977c 100644 --- a/acumate-plugin/src/extension.ts +++ b/acumate-plugin/src/extension.ts @@ -236,6 +236,8 @@ function init(context: vscode.ExtensionContext) { AcuMateContext.HtmlValidator = vscode.languages.createDiagnosticCollection('htmlValidator'); AcuMateContext.repositoryPath = getRepositoryPath(); + + vscode.commands.executeCommand('typescript.restartTsServer'); } function getRepositoryPath(): string | undefined { diff --git a/acumate-plugin/src/scaffolding/create-screen-extension/create-screen-extension.ts b/acumate-plugin/src/scaffolding/create-screen-extension/create-screen-extension.ts index accb30c..82ac34b 100644 --- a/acumate-plugin/src/scaffolding/create-screen-extension/create-screen-extension.ts +++ b/acumate-plugin/src/scaffolding/create-screen-extension/create-screen-extension.ts @@ -145,8 +145,18 @@ export async function createScreenExtension() { if (uri) { const document = await vscode.workspace.openTextDocument(uri); await vscode.window.showTextDocument(document); - if (AcuMateContext.ConfigurationService.clearUsages) { - await vscode.commands.executeCommand(`editor.action.organizeImports`); + if (AcuMateContext.ConfigurationService.clearUsages) { + const handler = vscode.workspace.onDidChangeTextDocument(doc => { + if (doc.document.uri.path === document.uri.path) { + try { + doc.document.save(); + } finally { + handler.dispose(); + } + } + }); + setTimeout(() => handler.dispose(), 5000); // Fallback timeout + await vscode.commands.executeCommand('editor.action.organizeImports'); } } } \ No newline at end of file diff --git a/acumate-plugin/src/scaffolding/create-screen/create-screen.ts b/acumate-plugin/src/scaffolding/create-screen/create-screen.ts index 8f0faba..be627a5 100644 --- a/acumate-plugin/src/scaffolding/create-screen/create-screen.ts +++ b/acumate-plugin/src/scaffolding/create-screen/create-screen.ts @@ -133,7 +133,17 @@ export async function createScreen() { const document = await vscode.workspace.openTextDocument(uri); await vscode.window.showTextDocument(document); if (AcuMateContext.ConfigurationService.clearUsages) { - await vscode.commands.executeCommand(`editor.action.organizeImports`); + const handler = vscode.workspace.onDidChangeTextDocument(doc => { + if (doc.document.uri.path === document.uri.path) { + try { + doc.document.save(); + } finally { + handler.dispose(); + } + } + }); + setTimeout(() => handler.dispose(), 5000); // Fallback timeout + await vscode.commands.executeCommand('editor.action.organizeImports'); } } }