Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -348,7 +349,11 @@ public void setActiveModel(String modelName) {
// Persist using the composite key for proper identification
UserPreference preference = getUserPreference();
preference.setChatModel(compositeKey);
persistUserPreference();
// Persist asynchronously to avoid deadlock: persistUserPreference() calls
// persistence().get() which blocks waiting for the LSP listener thread.
// If called on the UI thread while the listener is in syncExec, both threads
// deadlock.
CompletableFuture.runAsync(this::persistUserPreference);
Comment thread
xinyi-gong marked this conversation as resolved.

// Update observable
ensureRealm(() -> activeModelObservable.setValue(model));
Expand Down
Loading