File tree Expand file tree Collapse file tree
src/main/kotlin/com/github/adrienpessu/sarifviewer/toolWindow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -586,7 +586,16 @@ class SarifViewerWindowFactory : ToolWindowFactory {
586586 private fun findPath (project : Project , path : String ): VirtualFile ? {
587587 val fileName = path.substring(path.lastIndexOf(' /' )+ 1 )
588588 val pathOnly = path.substring(0 , path.lastIndexOf(' /' )+ 1 )
589- val decompiledFileName = fileName.replace(" .scala" ," .java" ).replace(" .kt" ," .java" )
589+
590+ val lastDot = fileName.lastIndexOf(' .' )
591+ val decompiledFileName = if (lastDot != - 1 ) {
592+ val nameWithoutExt = fileName.substring(0 , lastDot)
593+ val ext = fileName.substring(lastDot + 1 )
594+ when (ext) {
595+ " scala" , " kt" -> " $nameWithoutExt .java"
596+ else -> fileName
597+ }
598+ } else fileName
590599 val collection : MutableCollection <VirtualFile > = FilenameIndex .getVirtualFilesByName(fileName, GlobalSearchScope .allScope(project))
591600 // during decompilation original file ext is lost
592601 collection.addAll(FilenameIndex .getVirtualFilesByName(decompiledFileName, GlobalSearchScope .allScope(project)))
You can’t perform that action at this time.
0 commit comments