Skip to content

Commit 9fcc3a7

Browse files
committed
Only recompile initialized SourceFiles during refresh
1 parent da46ca9 commit 9fcc3a7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ class SourcePath(
6868

6969
fun compile() = parse().apply { doCompile() }
7070

71+
fun compileIfInitialized() {
72+
if (parsed != null) {
73+
compile()
74+
}
75+
}
76+
7177
private fun doCompile() {
7278
LOG.debug("Compiling {}", path?.fileName)
7379

@@ -196,11 +202,11 @@ class SourcePath(
196202
}
197203

198204
/**
199-
* Recompiles ALL files.
205+
* Recompiles all source files that are initialized.
200206
*/
201207
fun refresh() {
202208
LOG.info("Refreshing source path")
203-
files.values.forEach { it.compile() }
209+
files.values.forEach { it.compileIfInitialized() }
204210
}
205211

206212
/**

0 commit comments

Comments
 (0)