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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user