Skip to content

Commit

Permalink
Avoid refreshing highlights/codelenses when...
Browse files Browse the repository at this point in the history
...nothing has changed. The refresh can be very expensive
if user has enabled code minings.

See: #292
  • Loading branch information
kdvolder committed May 17, 2019
1 parent 6a56a87 commit a247958
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,12 @@ private static Map<Annotation, Position> createAnnotations(IDocument doc, List<C
public synchronized void highlight(HighlightParams highlights) {
String target = highlights.getDoc().getUri();
if (target!=null) {
currentHighlights.put(target, highlights);
new UpdateHighlights(target);
HighlightParams oldHighligts = currentHighlights.get(target);
List<CodeLens> oldCodelenses = oldHighligts==null ? ImmutableList.of() : oldHighligts.getCodeLenses();
if (!oldCodelenses.equals(highlights.getCodeLenses())) {
currentHighlights.put(target, highlights);
new UpdateHighlights(target);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public synchronized void disableHighlights() {

private synchronized void start() {
if (highlightsEnabled && timer == null) {
logger.debug("Starting SpringLiveHoverWatchdog");
logger.info("Starting SpringLiveHoverWatchdog");
this.timer = new ScheduledThreadPoolExecutor(1);
this.timer.scheduleWithFixedDelay(() -> this.update(), 0, POLLING_INTERVAL_MILLISECONDS, TimeUnit.MILLISECONDS);
}
Expand Down

0 comments on commit a247958

Please sign in to comment.