Skip to content

Commit

Permalink
(WIP) fix for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Godin committed Nov 27, 2024
1 parent aa6621d commit 0b92eb9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.sonarsource.kotlin.api.frontend

import com.intellij.openapi.editor.Document
import com.intellij.openapi.util.io.FileUtil
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiErrorElement
import com.intellij.psi.PsiFile
Expand All @@ -45,11 +46,10 @@ data class KotlinSyntaxStructure(val ktFile: KtFile, val document: Document, val
fun of(content: String, environment: Environment, inputFile: InputFile): KotlinSyntaxStructure {

val psiFile: KtFile = if (environment.k2session != null) {
// FIXME quick hack
val inputFilePath = FileUtil.toSystemIndependentName(inputFile.file().path)
environment.k2session!!.modulesWithFiles.values.first()
.find {
// FIXME fails on Windows?
it.virtualFile.path == inputFile.uri().path
it.virtualFile.path == inputFilePath
} as KtFile
} else
environment.ktPsiFactory.createFile(inputFile.uri().path, normalizeEol(content))
Expand Down

0 comments on commit 0b92eb9

Please sign in to comment.