Skip to content

Commit c5fcacb

Browse files
committed
Pass IndexingConfiguration to SourcePath
1 parent 9f6f260 commit c5fcacb

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

server/src/main/kotlin/org/javacs/kt/KotlinLanguageServer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import java.util.concurrent.CompletableFuture
2020
import java.util.concurrent.CompletableFuture.completedFuture
2121

2222
class KotlinLanguageServer : LanguageServer, LanguageClientAware, Closeable {
23-
private val config = Configuration()
23+
val config = Configuration()
2424
val classPath = CompilerClassPath(config.compiler)
2525

2626
private val tempDirectory = TemporaryDirectory()
2727
private val uriContentProvider = URIContentProvider(JarClassContentProvider(config.externalSources, classPath, tempDirectory))
28-
val sourcePath = SourcePath(classPath, uriContentProvider)
28+
val sourcePath = SourcePath(classPath, uriContentProvider, config.indexing)
2929
val sourceFiles = SourceFiles(sourcePath, uriContentProvider)
3030

3131
private val textDocuments = KotlinTextDocumentService(sourceFiles, sourcePath, config, tempDirectory, uriContentProvider)

server/src/main/kotlin/org/javacs/kt/KotlinWorkspaceService.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class KotlinWorkspaceService(
128128
val indexing = config.indexing
129129
get("enabled")?.asBoolean?.let {
130130
indexing.enabled = it
131-
sp.indexEnabled = it
132131
}
133132
}
134133

server/src/main/kotlin/org/javacs/kt/SourcePath.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.javacs.kt.util.filePath
77
import org.javacs.kt.util.describeURI
88
import org.javacs.kt.index.SymbolIndex
99
import org.javacs.kt.progress.Progress
10+
import org.javacs.kt.IndexingConfiguration
1011
import com.intellij.lang.Language
1112
import com.intellij.psi.PsiFile
1213
import com.intellij.openapi.fileTypes.FileType
@@ -25,14 +26,15 @@ import java.util.concurrent.locks.ReentrantLock
2526

2627
class SourcePath(
2728
private val cp: CompilerClassPath,
28-
private val contentProvider: URIContentProvider
29+
private val contentProvider: URIContentProvider,
30+
private val indexingConfig: IndexingConfiguration
2931
) {
3032
private val files = mutableMapOf<URI, SourceFile>()
3133
private val parseDataWriteLock = ReentrantLock()
3234
private val indexAsync = AsyncExecutor()
3335

3436
val index = SymbolIndex()
35-
var indexEnabled = true
37+
var indexEnabled: Boolean by indexingConfig::enabled
3638
var beforeCompileCallback: () -> Unit = {}
3739

3840
var progressFactory: Progress.Factory = Progress.Factory.None

0 commit comments

Comments
 (0)