From 0b92eb9f34d53ea463ede6560b40a07b5a7cd2c8 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Wed, 27 Nov 2024 14:44:29 +0100 Subject: [PATCH] (WIP) fix for Windows --- .../java/org/sonarsource/kotlin/api/frontend/KotlinTree.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sonar-kotlin-api/src/main/java/org/sonarsource/kotlin/api/frontend/KotlinTree.kt b/sonar-kotlin-api/src/main/java/org/sonarsource/kotlin/api/frontend/KotlinTree.kt index d6e37fd08..f2b2b46cd 100644 --- a/sonar-kotlin-api/src/main/java/org/sonarsource/kotlin/api/frontend/KotlinTree.kt +++ b/sonar-kotlin-api/src/main/java/org/sonarsource/kotlin/api/frontend/KotlinTree.kt @@ -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 @@ -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))