Skip to content

Commit 34fa4ff

Browse files
committed
Fix language extension issue (for now)
1 parent 2039254 commit 34fa4ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import org.javacs.kt.util.filePath
77
import org.javacs.kt.util.describeURI
88
import com.intellij.lang.Language
99
import com.intellij.psi.PsiFile
10+
import com.intellij.openapi.fileTypes.FileType
11+
import com.intellij.openapi.fileTypes.LanguageFileType
1012
import org.jetbrains.kotlin.container.ComponentProvider
1113
import org.jetbrains.kotlin.container.getService
1214
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
@@ -41,7 +43,7 @@ class SourcePath(
4143
val language: Language? = null,
4244
val isTemporary: Boolean = false // A temporary source file will not be returned by .all()
4345
) {
44-
val extension: String? = uri.fileExtension ?: language?.associatedFileType?.defaultExtension
46+
val extension: String? = uri.fileExtension ?: "kt" // TODO: Use language?.associatedFileType?.defaultExtension again
4547
val isScript: Boolean = extension == "kts"
4648
val kind: CompilationKind =
4749
if (path?.fileName?.toString()?.endsWith(".gradle.kts") ?: false) CompilationKind.BUILD_SCRIPT

0 commit comments

Comments
 (0)