File tree Expand file tree Collapse file tree
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import java .util .HashMap ;
88import java .util .List ;
99import java .util .Map ;
10+ import java .util .concurrent .CompletableFuture ;
1011import java .util .concurrent .ExecutionException ;
1112
1213import org .apache .commons .lang3 .StringUtils ;
@@ -348,7 +349,11 @@ public void setActiveModel(String modelName) {
348349 // Persist using the composite key for proper identification
349350 UserPreference preference = getUserPreference ();
350351 preference .setChatModel (compositeKey );
351- persistUserPreference ();
352+ // Persist asynchronously to avoid deadlock: persistUserPreference() calls
353+ // persistence().get() which blocks waiting for the LSP listener thread.
354+ // If called on the UI thread while the listener is in syncExec, both threads
355+ // deadlock.
356+ CompletableFuture .runAsync (this ::persistUserPreference );
352357
353358 // Update observable
354359 ensureRealm (() -> activeModelObservable .setValue (model ));
You can’t perform that action at this time.
0 commit comments