Skip to content

Commit 0affa72

Browse files
authored
Fix go-to-def race with TC (#1030). (#1031)
1 parent aeae3fa commit 0affa72

File tree

1 file changed

+5
-5
lines changed
  • rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/rascal/model

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.rascalmpl.vscode.lsp.util.concurrent.ReplaceableFuture;
5151
import org.rascalmpl.vscode.lsp.util.locations.Locations;
5252

53+
import io.usethesource.vallang.IConstructor;
5354
import io.usethesource.vallang.ISourceLocation;
5455

5556
public class FileFacts {
@@ -155,12 +156,11 @@ public ActualFileFact(ISourceLocation file, Executor exec) {
155156
InterruptibleFuture.completedFuture(new SummaryBridge(), exec),
156157
r -> {
157158
r.interrupt();
158-
var summaryCalc = rascal.getSummary(file, confs.lookupConfig(file))
159-
.<@Nullable SummaryBridge>thenApply(s -> s == null ? null : new SummaryBridge(file, s, cm));
160-
// only run get summary after the typechecker for this file is done running
159+
// only run get summary after the typechecker for this file is done running, because it needs the TPL
161160
// (we cannot now global running type checkers, that is a different subject)
162-
var mergedCalc = typeCheckResults.get().<@Nullable SummaryBridge>thenCompose(o -> summaryCalc.get());
163-
return new InterruptibleFuture<>(mergedCalc, summaryCalc::interrupt);
161+
return InterruptibleFuture.flatten(typeCheckResults.get()
162+
.<InterruptibleFuture<@Nullable IConstructor>>thenApply(o -> rascal.getSummary(file, confs.lookupConfig(file))), exec)
163+
.<@Nullable SummaryBridge>thenApply(s -> s == null ? null : new SummaryBridge(file, s, cm));
164164
});
165165
}
166166

0 commit comments

Comments
 (0)