do not preload indices in LightEdit mode

GitOrigin-RevId: 7abd66b275d01916ccd7023e3881276c2e6a6a45
This commit is contained in:
Dmitry Avdeev
2020-01-16 08:11:51 +00:00
committed by intellij-monorepo-bot
parent 5c9b0d5489
commit 4b225d15e6
4 changed files with 15 additions and 3 deletions
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
*/
public final class ServiceDescriptor {
public enum PreloadMode {
TRUE, FALSE, AWAIT, NOT_HEADLESS,
TRUE, FALSE, AWAIT, NOT_HEADLESS, NOT_LIGHT_EDIT
}
@Attribute
@@ -433,6 +433,9 @@ public final class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor, Plu
else if (preload.equals("notHeadless")) {
descriptor.preload = ServiceDescriptor.PreloadMode.NOT_HEADLESS;
}
else if (preload.equals("notLightEdit")) {
descriptor.preload = ServiceDescriptor.PreloadMode.NOT_LIGHT_EDIT;
}
else {
LOG.error("Unknown preload mode value: " + JDOMUtil.writeElement(element));
}
@@ -34,7 +34,7 @@
<!-- FileBasedIndex / SerializationManager is quite important and in any case will be used, better to preload it -->
<applicationService serviceInterface="com.intellij.util.indexing.FileBasedIndex"
serviceImplementation="com.intellij.util.indexing.FileBasedIndexImpl" preload="true"/>
serviceImplementation="com.intellij.util.indexing.FileBasedIndexImpl" preload="notLightEdit"/>
<vfs.asyncListener implementation="com.intellij.util.indexing.FileBasedIndexImpl$ChangedFilesCollector"/>
<!-- required for any persistence state component (pathMacroSubstitutor.expandPaths), so, preload -->
@@ -42,7 +42,7 @@
serviceImplementation="com.intellij.ide.macro.IdePathMacros" preload="true"/>
<applicationService serviceInterface="com.intellij.psi.stubs.StubIndex"
serviceImplementation="com.intellij.psi.stubs.StubIndexImpl" preload="true"/>
serviceImplementation="com.intellij.psi.stubs.StubIndexImpl" preload="notLightEdit"/>
<applicationService serviceInterface="com.intellij.codeInsight.completion.CompletionService"
serviceImplementation="com.intellij.codeInsight.completion.impl.CompletionServiceImpl"
@@ -6,6 +6,7 @@ import com.intellij.diagnostic.PluginException
import com.intellij.diagnostic.StartUpMeasurer
import com.intellij.ide.plugins.*
import com.intellij.ide.plugins.cl.PluginClassLoader
import com.intellij.idea.Main
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.Application
import com.intellij.openapi.application.ApplicationManager
@@ -677,6 +678,14 @@ abstract class PlatformComponentManagerImpl @JvmOverloads constructor(internal v
asyncPreloadedServices
}
}
PreloadMode.NOT_LIGHT_EDIT -> {
if (onlyIfAwait || Main.isLightEdit()) {
continue@serviceLoop
}
else {
asyncPreloadedServices
}
}
PreloadMode.AWAIT -> {
syncPreloadedServices
}