@@ -8,6 +8,7 @@ import org.eclipse.lsp4j.services.LanguageClientAware
88import org.eclipse.lsp4j.services.LanguageServer
99import org.eclipse.lsp4j.services.NotebookDocumentService
1010import org.javacs.kt.command.ALL_COMMANDS
11+ import org.javacs.kt.database.DatabaseService
1112import org.javacs.kt.progress.LanguageClientProgress
1213import org.javacs.kt.progress.Progress
1314import org.javacs.kt.semantictokens.semanticTokensLegend
@@ -23,11 +24,12 @@ import java.util.concurrent.CompletableFuture.completedFuture
2324
2425class KotlinLanguageServer : LanguageServer , LanguageClientAware , Closeable {
2526 val config = Configuration ()
26- val classPath = CompilerClassPath (config.compiler)
27+ val databaseService = DatabaseService ()
28+ val classPath = CompilerClassPath (config.compiler, databaseService)
2729
2830 private val tempDirectory = TemporaryDirectory ()
2931 private val uriContentProvider = URIContentProvider (ClassContentProvider (config.externalSources, classPath, tempDirectory, CompositeSourceArchiveProvider (JdkSourceArchiveProvider (classPath), ClassPathSourceArchiveProvider (classPath))))
30- val sourcePath = SourcePath (classPath, uriContentProvider, config.indexing)
32+ val sourcePath = SourcePath (classPath, uriContentProvider, config.indexing, databaseService )
3133 val sourceFiles = SourceFiles (sourcePath, uriContentProvider)
3234
3335 private val textDocuments = KotlinTextDocumentService (sourceFiles, sourcePath, config, tempDirectory, uriContentProvider, classPath)
@@ -90,10 +92,8 @@ class KotlinLanguageServer : LanguageServer, LanguageClientAware, Closeable {
9092 serverCapabilities.executeCommandProvider = ExecuteCommandOptions (ALL_COMMANDS )
9193 serverCapabilities.documentHighlightProvider = Either .forLeft(true )
9294
93- val db = setupServerDatabase(params)
94-
95- sourcePath.index = if (db != null ) SymbolIndex (db) else SymbolIndex ()
96- classPath.db = db
95+ val storagePath = getStoragePath(params)
96+ databaseService.setup(storagePath)
9797
9898 val clientCapabilities = params.capabilities
9999 config.completion.snippets.enabled = clientCapabilities?.textDocument?.completion?.completionItem?.snippetSupport ? : false
0 commit comments