File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
server/src/main/kotlin/org/javacs/kt Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ public data class CompilerConfiguration(
23
23
val jvm : JVMConfiguration = JVMConfiguration ()
24
24
)
25
25
26
+ public data class IndexingConfiguration (
27
+ /* * Whether an index of global symbols should be built in the background. */
28
+ var enabled : Boolean = true
29
+ )
30
+
26
31
public data class ExternalSourcesConfiguration (
27
32
/* * Whether kls-URIs should be sent to the client to describe classes in JARs. */
28
33
var useKlsScheme : Boolean = false ,
@@ -34,5 +39,6 @@ public data class Configuration(
34
39
val compiler : CompilerConfiguration = CompilerConfiguration (),
35
40
val completion : CompletionConfiguration = CompletionConfiguration (),
36
41
val linting : LintingConfiguration = LintingConfiguration (),
42
+ var indexing : IndexingConfiguration = IndexingConfiguration (),
37
43
val externalSources : ExternalSourcesConfiguration = ExternalSourcesConfiguration ()
38
44
)
Original file line number Diff line number Diff line change @@ -123,6 +123,15 @@ class KotlinWorkspaceService(
123
123
}
124
124
}
125
125
126
+ // Update indexing options
127
+ get(" indexing" )?.asJsonObject?.apply {
128
+ val indexing = config.indexing
129
+ get(" enabled" )?.asBoolean?.let {
130
+ indexing.enabled = it
131
+ sp.indexEnabled = it
132
+ }
133
+ }
134
+
126
135
// Update options about external sources e.g. JAR files, decompilers, etc
127
136
get(" externalSources" )?.asJsonObject?.apply {
128
137
val externalSources = config.externalSources
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class SourcePath(
31
31
private val indexAsync = AsyncExecutor ()
32
32
33
33
val index = SymbolIndex ()
34
+ var indexEnabled = true
34
35
var beforeCompileCallback: () -> Unit = {}
35
36
36
37
private inner class SourceFile (
@@ -201,7 +202,7 @@ class SourcePath(
201
202
}
202
203
203
204
// Only index normal files, not build files
204
- if (kind == CompilationKind .DEFAULT ) {
205
+ if (indexEnabled && kind == CompilationKind .DEFAULT ) {
205
206
updateIndexAsync(container)
206
207
}
207
208
@@ -222,8 +223,8 @@ class SourcePath(
222
223
* Updates the symbol index asynchronously.
223
224
*/
224
225
private fun updateIndexAsync (container : ComponentProvider ) = indexAsync.execute {
225
- // val module = container.getService(ModuleDescriptor::class.java)
226
- // index.update(module)
226
+ val module = container.getService(ModuleDescriptor ::class .java)
227
+ index.update(module)
227
228
}
228
229
229
230
/* *
You can’t perform that action at this time.
0 commit comments