File tree 1 file changed +5
-1
lines changed
server/src/main/kotlin/org/javacs/kt 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.psi.KtFile
14
14
import org.jetbrains.kotlin.resolve.BindingContext
15
15
import org.jetbrains.kotlin.resolve.CompositeBindingContext
16
16
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
17
+ import org.jetbrains.kotlin.diagnostics.Severity
17
18
import kotlin.concurrent.withLock
18
19
import java.nio.file.Path
19
20
import java.nio.file.Paths
@@ -59,6 +60,9 @@ class SourcePath(
59
60
if (path?.fileName?.toString()?.endsWith(" .gradle.kts" ) ? : false ) CompilationKind .BUILD_SCRIPT
60
61
else CompilationKind .DEFAULT
61
62
63
+ val hasErrors: Boolean
64
+ get() = compiledContext?.diagnostics?.any { it.severity == Severity .ERROR } ? : false
65
+
62
66
fun put (newContent : String ) {
63
67
content = newContent
64
68
}
@@ -268,7 +272,7 @@ class SourcePath(
268
272
*/
269
273
fun save (uri : URI ) {
270
274
files[uri]?.let {
271
- if (! it.isScript) {
275
+ if (! it.isScript && ! it.hasErrors ) {
272
276
// If the code generation fails for some reason, we generate code for the other files anyway
273
277
try {
274
278
cp.compiler.removeGeneratedCode(listOfNotNull(it.lastSavedFile))
You can’t perform that action at this time.
0 commit comments