Skip to content

Commit 2c218e4

Browse files
ethan-vanderheijdenrgrunber
authored andcommitted
Give ResponseStore for code actions a minimum history size of 8.
1 parent 8b9892c commit 2c218e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CodeActionHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@
7777
import com.google.gson.JsonElement;
7878

7979
public class CodeActionHandler {
80+
// Store a few of the latest Code Action results because any one of them might be resolved further.
81+
// Multiple Code Actions are computed in parallel through ForkJoinPool's common pool leading to a race condition where
82+
// the last Code Action request to finish processing is not the client's latest request. History size must scale with pool size.
8083
public static final ResponseStore<Either<ChangeCorrectionProposalCore, CodeActionProposal>> codeActionStore
81-
= new ResponseStore<>(ForkJoinPool.commonPool().getParallelism());
84+
= new ResponseStore<>(Math.max(ForkJoinPool.getCommonPoolParallelism(), 8));
8285
public static final String COMMAND_ID_APPLY_EDIT = "java.apply.workspaceEdit";
8386

8487
public static CodeActionOptions createOptions(PreferenceManager preferenceManager) {

0 commit comments

Comments
 (0)