diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.kt b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.kt index 57ddff56eb85..7fc21aeea3dd 100644 --- a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.kt +++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.kt @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,7 @@ class SourceResolver(private val rawSources: List, internal val canonica return null } - fun getLocalFilePath(entry: MappingEntry) = canonicalizedUrls.getOrNull(entry.source)?.let { if (it.isInLocalFileSystem) it.path else null } + fun getUrlIfLocalFile(entry: MappingEntry) = canonicalizedUrls.getOrNull(entry.source)?.let { if (it.isInLocalFileSystem) it else null } companion object { fun isAbsolute(path: String) = path.firstOrNull() == '/' || (SystemInfo.isWindows && (path.length > 2 && path[1] == ':')) diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.kt index c86ffa5561f7..e61b33c4b24a 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.kt +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.kt @@ -20,11 +20,25 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.OpenFileDescriptor import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile +import com.intellij.util.Url +import com.intellij.util.Urls import com.intellij.xdebugger.XSourcePosition -class SourceInfo(private val file: VirtualFile, private val line: Int, val column: Int = -1, private var offset: Int = -1, val functionName: String? = null) : XSourcePosition { +class SourceInfo @JvmOverloads constructor(private val file: VirtualFile, private val line: Int, val column: Int = -1, private var offset: Int = -1, val functionName: String? = null, url: Url? = null) : XSourcePosition { + private var _url = url + override fun getFile() = file + val url: Url + get() { + var result = _url + if (result == null) { + result = Urls.newFromVirtualFile(file) + _url = result + } + return result + } + override fun getLine() = line override fun getOffset(): Int {