From c7e43bf4bca3a632e5896da970cbfac2e44a3ea5 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 14 Sep 2017 18:57:35 +0200 Subject: [PATCH] Put stubs for different file types in different directories --- .../lang-impl/src/com/intellij/psi/stubs/PrebuiltStubs.kt | 7 +++---- .../python/psi/impl/stubs/PyPrebuiltStubsProvider.java | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/PrebuiltStubs.kt b/platform/lang-impl/src/com/intellij/psi/stubs/PrebuiltStubs.kt index 1db3521abee7..e2a46faddba7 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/PrebuiltStubs.kt +++ b/platform/lang-impl/src/com/intellij/psi/stubs/PrebuiltStubs.kt @@ -95,6 +95,7 @@ abstract class PrebuiltStubsProviderBase : PrebuiltStubsProvider, Disposable { private var mySerializationManager: SerializationManagerImpl? = null protected abstract val stubVersion: Int + protected abstract val name: String init { init() @@ -184,7 +185,7 @@ abstract class PrebuiltStubsProviderBase : PrebuiltStubsProvider, Disposable { @Throws(IOException::class) private fun copyPrebuiltIndexesToIndexRoot(prebuiltIndicesRoot: File): File { - val indexRoot = File(IndexInfrastructure.getPersistentIndexRoot(), "prebuilt") + val indexRoot = File(IndexInfrastructure.getPersistentIndexRoot(), "prebuilt/" + name) FileUtil.copyDir(prebuiltIndicesRoot, indexRoot) @@ -197,9 +198,7 @@ abstract class PrebuiltStubsProviderBase : PrebuiltStubsProvider, Disposable { return File(path) } path = PathManager.getHomePath() - var f = File(path, "python/index") // from sources - if (f.exists()) return f - f = File(path, "index") // compiled binary + val f = File(path, "index/$name") // compiled binary return if (f.exists()) f else null } } \ No newline at end of file diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java index 077b9f0f13c9..1483737d9d3b 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyPrebuiltStubsProvider.java @@ -16,7 +16,9 @@ package com.jetbrains.python.psi.impl.stubs; import com.intellij.psi.stubs.PrebuiltStubsProviderBase; +import com.jetbrains.python.PythonFileType; import com.jetbrains.python.psi.PyFileElementType; +import org.jetbrains.annotations.NotNull; /** * @author traff @@ -26,4 +28,10 @@ public class PyPrebuiltStubsProvider extends PrebuiltStubsProviderBase { protected int getStubVersion() { return PyFileElementType.INSTANCE.getStubVersion(); } + + @NotNull + @Override + protected String getName() { + return PythonFileType.INSTANCE.getName(); + } }