Skip to content

Commit 7f0fd7d

Browse files
Use lastTreeWithoutErrors for calculating code lenses (#673)
1 parent bc2d1a0 commit 7f0fd7d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ private void parse() {
166166
treeAsync.completeExceptionally(e);
167167
} else {
168168
var tree = new Versioned<>(version, t, timestamp);
169-
treeAsync.complete(tree);
170169
Versioned.replaceIfNewer(last, tree);
171170
if (diagnosticsList.isEmpty()) {
172171
Versioned.replaceIfNewer(lastWithoutErrors, tree);
173172
}
173+
treeAsync.complete(tree);
174174
}
175175

176176
// Complete future to get diagnostics

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams param
541541
}
542542
return r;
543543
})
544+
// Replace with the last tree without errors, might be the same as `tree` if the parse succeeded without any error recovery
545+
.thenApply(tree -> f.getLastTreeWithoutErrors())
544546
.thenApply(Versioned::get)
545547
.thenApplyAsync(rascalServices::locateCodeLenses, ownExecuter)
546548
.thenApply(List::stream)

0 commit comments

Comments
 (0)