Skip to content

Commit 1ce35c2

Browse files
committed
Pass source path directly to createContainer
1 parent e6ac863 commit 1ce35c2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ private class CompilationEnvironment(
163163
configFiles = EnvironmentConfigFiles.JVM_CONFIG_FILES
164164
)
165165

166-
// TODO: Use environment.addKotlinSourceRoots(workspaceRoots) and update those instead of using a custom SourcePath/SourceFile mechanism
166+
// TODO: Update VFS source files directly inside the environment instead of using a custom SourcePath/SourceFile mechanism
167+
// environment.addKotlinSourceRoots(workspaceRoots.map { it.toFile() })
167168

168169
val project = environment.project
169170
if (project is MockProject) {
@@ -194,13 +195,14 @@ private class CompilationEnvironment(
194195
fun createContainer(sourcePath: Collection<KtFile>): Pair<ComponentProvider, BindingTraceContext> {
195196
val trace = CliBindingTrace()
196197
val container = TopDownAnalyzerFacadeForJVM.createContainer(
197-
project = environment.project,
198-
files = listOf(),
199-
trace = trace,
200-
configuration = environment.configuration,
201-
packagePartProvider = environment::createPackagePartProvider,
202-
// TODO FileBasedDeclarationProviderFactory keeps indices, re-use it across calls
203-
declarationProviderFactory = { storageManager, _ -> FileBasedDeclarationProviderFactory(storageManager, sourcePath) })
198+
project = environment.project,
199+
files = sourcePath,
200+
trace = trace,
201+
configuration = environment.configuration,
202+
packagePartProvider = environment::createPackagePartProvider,
203+
// TODO FileBasedDeclarationProviderFactory keeps indices, re-use it across calls
204+
declarationProviderFactory = ::FileBasedDeclarationProviderFactory
205+
)
204206
return Pair(container, trace)
205207
}
206208

0 commit comments

Comments
 (0)