File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/main/java/com/github/_1c_syntax/bsl/languageserver Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -530,9 +530,18 @@ public void didClose(DidCloseTextDocumentParams params) {
530530 // Wait for all queued changes to complete (with timeout to avoid hanging)
531531 if (!docExecutor .awaitTermination (AWAIT_CLOSE , TimeUnit .SECONDS )) {
532532 docExecutor .shutdownNow ();
533+ // Must wait for worker thread to finish even after shutdownNow,
534+ // because finally block in worker may still be executing flushPendingChanges
535+ docExecutor .awaitTermination (1 , TimeUnit .SECONDS );
533536 }
534537 } catch (InterruptedException e ) {
535538 docExecutor .shutdownNow ();
539+ // Wait briefly for worker to finish after interrupt
540+ try {
541+ docExecutor .awaitTermination (1 , TimeUnit .SECONDS );
542+ } catch (InterruptedException ignored ) {
543+ // Already interrupted, just restore flag
544+ }
536545 Thread .currentThread ().interrupt ();
537546 }
538547 }
You can’t perform that action at this time.
0 commit comments