JS debugger: don't try to map 'this' using sourcemap positions (WEB-34822)

This commit is contained in:
Konstantin Ulitin
2018-09-25 18:48:25 +03:00
parent 9ecedda64e
commit eb832b090d
2 changed files with 9 additions and 5 deletions
@@ -17,7 +17,6 @@ package com.intellij.javascript.debugger
import com.google.common.base.CharMatcher
import com.intellij.openapi.editor.Document
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNamedElement
@@ -40,8 +39,11 @@ open class NameMapper(private val document: Document, private val transpiledDocu
// PsiNamedElement, JSVariable for example
// returns generated name
@JvmOverloads
open fun map(identifierOrNamedElement: PsiElement, forceMapBySourceCode: Boolean = false): String? {
open fun map(identifierOrNamedElement: PsiElement): String? {
return doMap(identifierOrNamedElement, false)
}
protected fun doMap(identifierOrNamedElement: PsiElement, mapBySourceCode: Boolean): String? {
val offset = identifierOrNamedElement.textOffset
val line = document.getLineNumber(offset)
@@ -70,7 +72,7 @@ open class NameMapper(private val document: Document, private val transpiledDocu
}
var sourceName = sourceEntry.name
if (sourceName == null || forceMapBySourceCode || Registry.`is`("js.debugger.name.mappings.by.source.code", false)) {
if (sourceName == null || mapBySourceCode) {
sourceName = (identifierOrNamedElement as? PsiNamedElement)?.name ?: identifierOrNamedElement.text ?: sourceName ?: return null
}
@@ -965,7 +965,9 @@ js.debugger.v8.use.any.breakpoint=true
js.debugger.chrome.use.any.breakpoint=true
nodejs.debugger.use.jb.support=true
js.debugger.name.mappings.by.source.code=false
js.debugger.map.this.by.source.code=true
js.debugger.name.mappings.by.source.code.description=Use source map positions to get names matching all local symbols
js.debugger.map.this.by.source.code=false
js.debugger.map.this.by.source.code.description=Use source map positions to get name matching 'this'
js.debugger.v8.log=
js.debugger.wip.log=
js.debugger.fix.jspm.source.maps=false