Avoid refreshing highlights/codelenses when...

...nothing has changed. The refresh can be very expensive
if user has enabled code minings.

See: https://github.com/spring-projects/sts4/issues/292
This commit is contained in:
Kris De Volder
2019-05-17 12:56:47 -07:00
parent 6a56a87ab9
commit a247958351
2 changed files with 7 additions and 3 deletions

View File

@@ -319,8 +319,12 @@ public class STS4LanguageClientImpl extends LanguageClientImpl implements STS4La
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);
}
}
}

View File

@@ -115,7 +115,7 @@ public class SpringLiveHoverWatchdog {
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);
}