Put stubs for different file types in different directories

This commit is contained in:
Dmitry Trofimov
2017-09-14 18:59:11 +02:00
parent bde33431ba
commit c7e43bf4bc
2 changed files with 11 additions and 4 deletions
@@ -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
}
}
@@ -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();
}
}