Skip to content

Commit 4965738

Browse files
authored
Allocate completed futures on dedicated thread pools. (#932)
1 parent 1a577d4 commit 4965738

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/parametric/model/ParametricFileFacts.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public void clearDiagnostics() {
480480

481481
@Override
482482
public <T> CompletableFuture<List<T>> lookupInSummaries(SummaryLookup<T> lookup, Versioned<ITree> tree, Position cursor) {
483-
return CompletableFuture.completedFuture(List.of());
483+
return CompletableFutureUtils.completedFuture(List.of(), exec);
484484
}
485485
}
486486
}

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/RascalTextDocumentService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ private MessageParams setMessageParams(IConstructor message) {
490490
.thenApply(n -> new Hover(new MarkupContent("plaintext", n))), () -> null);
491491
}
492492
else {
493-
return CompletableFuture.completedFuture(null);
493+
return CompletableFutureUtils.completedFuture(null, exec);
494494
}
495495
}
496496

@@ -706,7 +706,7 @@ public CompletableFuture<List<Either<Command, CodeAction>>> codeAction(CodeActio
706706
private CompletableFuture<IList> computeCodeActions(final int startLine, final int startColumn, ITree tree, PathConfig pcfg) {
707707
return CompletableFuture.supplyAsync(() -> TreeSearch.computeFocusList(tree, startLine, startColumn), exec)
708708
.thenCompose(focus -> focus.isEmpty()
709-
? CompletableFuture.completedFuture(focus /* an empty list */)
709+
? CompletableFutureUtils.completedFuture(focus /* an empty list */, exec)
710710
: availableRascalServices().codeActions(focus, pcfg).get());
711711
}
712712

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/model/FileFacts.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.rascalmpl.vscode.lsp.rascal.RascalLanguageServices;
4646
import org.rascalmpl.vscode.lsp.util.Diagnostics;
4747
import org.rascalmpl.vscode.lsp.util.Lists;
48+
import org.rascalmpl.vscode.lsp.util.concurrent.CompletableFutureUtils;
4849
import org.rascalmpl.vscode.lsp.util.concurrent.InterruptibleFuture;
4950
import org.rascalmpl.vscode.lsp.util.concurrent.LazyUpdateableReference;
5051
import org.rascalmpl.vscode.lsp.util.concurrent.ReplaceableFuture;
@@ -205,7 +206,7 @@ public void close() {
205206
public void clearDiagnostics() {
206207
summary.invalidate();
207208
typeCheckerMessages.clear();
208-
typeCheckResults.replace(CompletableFuture.completedFuture(Map.of()));
209+
typeCheckResults.replace(CompletableFutureUtils.completedFuture(Map.of(), exec));
209210
client.publishDiagnostics(new PublishDiagnosticsParams(Locations.toUri(file).toString(), List.of()));
210211
}
211212
}
@@ -223,7 +224,7 @@ public void reportTypeCheckerErrors(List<Diagnostic> msgs) {
223224

224225
@Override
225226
public CompletableFuture<@Nullable SummaryBridge> getSummary() {
226-
return CompletableFuture.completedFuture(null);
227+
return CompletableFutureUtils.completedFuture(null, exec);
227228
}
228229

229230
@Override

0 commit comments

Comments
 (0)