File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,8 @@ function init(context: vscode.ExtensionContext) {
236236 AcuMateContext . HtmlValidator = vscode . languages . createDiagnosticCollection ( 'htmlValidator' ) ;
237237
238238 AcuMateContext . repositoryPath = getRepositoryPath ( ) ;
239+
240+ vscode . commands . executeCommand ( 'typescript.restartTsServer' ) ;
239241}
240242
241243function getRepositoryPath ( ) : string | undefined {
Original file line number Diff line number Diff line change @@ -145,8 +145,18 @@ export async function createScreenExtension() {
145145 if ( uri ) {
146146 const document = await vscode . workspace . openTextDocument ( uri ) ;
147147 await vscode . window . showTextDocument ( document ) ;
148- if ( AcuMateContext . ConfigurationService . clearUsages ) {
149- await vscode . commands . executeCommand ( `editor.action.organizeImports` ) ;
148+ if ( AcuMateContext . ConfigurationService . clearUsages ) {
149+ const handler = vscode . workspace . onDidChangeTextDocument ( doc => {
150+ if ( doc . document . uri . path === document . uri . path ) {
151+ try {
152+ doc . document . save ( ) ;
153+ } finally {
154+ handler . dispose ( ) ;
155+ }
156+ }
157+ } ) ;
158+ setTimeout ( ( ) => handler . dispose ( ) , 5000 ) ; // Fallback timeout
159+ await vscode . commands . executeCommand ( 'editor.action.organizeImports' ) ;
150160 }
151161 }
152162}
Original file line number Diff line number Diff line change @@ -133,7 +133,17 @@ export async function createScreen() {
133133 const document = await vscode . workspace . openTextDocument ( uri ) ;
134134 await vscode . window . showTextDocument ( document ) ;
135135 if ( AcuMateContext . ConfigurationService . clearUsages ) {
136- await vscode . commands . executeCommand ( `editor.action.organizeImports` ) ;
136+ const handler = vscode . workspace . onDidChangeTextDocument ( doc => {
137+ if ( doc . document . uri . path === document . uri . path ) {
138+ try {
139+ doc . document . save ( ) ;
140+ } finally {
141+ handler . dispose ( ) ;
142+ }
143+ }
144+ } ) ;
145+ setTimeout ( ( ) => handler . dispose ( ) , 5000 ) ; // Fallback timeout
146+ await vscode . commands . executeCommand ( 'editor.action.organizeImports' ) ;
137147 }
138148 }
139149}
You can’t perform that action at this time.
0 commit comments