Skip to content

Commit

Permalink
Code improvements from the review.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdedic committed Sep 14, 2024
1 parent b6e0720 commit 2d925f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,9 @@ public static CompletableFuture<ProjectState> withProjectState(Project p, final
// special case if the state matches & is consistent: if the attempted quality is LESS
// than this request's target, the ReloadImplementation might give up
if (!doReload && lastKnown.target.isAtLeast(stateRequest.getTargetQuality())) {
LOG.log(Level.FINE, "FINISHED: Reload {0}, request: {1}, state {2} - NOOP, finished", new Object[] { p, stateRequest, lastKnown.toString() });
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "FINISHED: Reload {0}, request: {1}, state {2} - NOOP, finished", new Object[] { p, stateRequest, lastKnown.toString() });
}
return CompletableFuture.completedFuture(lastKnown);
}
String reason = stateRequest.getReason();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,7 @@ private CompletableFuture<ProjectState> maybeMakeRetry(Collection variant) {
if (LOG.isLoggable(Level.FINE)) {
String s = Stream.concat(fileInconsistencies.stream(),retries.stream()).
map(c -> c.impl.getClass().getName()).collect(Collectors.joining(", "));
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "{0} reloads again because of {1}", new Object[]{toString(), s});
}
LOG.log(Level.FINE, "{0} reloads again because of {1}", new Object[]{toString(), s});
}
this.lastRetries = retries;
this.lastInconsistent = fileInconsistencies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,9 @@ public void didSave(DidSaveTextDocumentParams savedParams) {
org.openide.util.Task t = (org.openide.util.Task)reload.invoke(cake);
// wait for a limited time, this could be enough for the reload to complete, blocking LSP queue. We do not want to block LSP queue indefinitely:
// in case of an error, the server could become unresponsive.
t.waitFinished(300);
if (!t.waitFinished(300)) {
LOG.log(Level.WARNING, "{0}: document reload did not finish in 300ms", file);
}
} catch (ReflectiveOperationException | InterruptedException | SecurityException ex) {
// nop
}
Expand Down

0 comments on commit 2d925f2

Please sign in to comment.