WEB-19984 Debugging Node.js app built with Webpack

This commit is contained in:
Vladimir Krivosheev
2016-01-25 16:30:52 +01:00
parent 312b235ffd
commit ec2c691cbf
2 changed files with 17 additions and 3 deletions
@@ -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<String>, 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] == ':'))
@@ -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 {