mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[debugger] add more usages of XBreakpointUtil in Kotlin code
GitOrigin-RevId: 2fb6fbbe6508b6244e4148ff66db451f5ccc358a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9ecf7bdf03
commit
c25ada2800
@@ -1186,6 +1186,7 @@ f:com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil
|
||||
f:com.intellij.xdebugger.impl.breakpoints.XBreakpointUtilKt
|
||||
- sf:getDisplayText(com.intellij.xdebugger.breakpoints.XBreakpoint):java.lang.String
|
||||
- sf:getGeneralDescription(com.intellij.xdebugger.breakpoints.XBreakpoint):java.lang.String
|
||||
- sf:getHighlightRange(com.intellij.xdebugger.breakpoints.XLineBreakpoint):com.intellij.openapi.util.TextRange
|
||||
- sf:getPropertyXMLDescriptions(com.intellij.xdebugger.breakpoints.XBreakpoint):java.util.List
|
||||
- sf:getShortText(com.intellij.xdebugger.breakpoints.XBreakpoint):java.lang.String
|
||||
f:com.intellij.xdebugger.impl.breakpoints.XBreakpointsDialogState
|
||||
|
||||
@@ -144,7 +144,9 @@ internal class BreakpointVariantPriorityTracker(private val coroutineScope: Coro
|
||||
}
|
||||
|
||||
readAction {
|
||||
if (lookSimilar(defaultBreakpoint, expectedBreakpoint)) {
|
||||
if (defaultBreakpoint.type == expectedBreakpoint.type &&
|
||||
defaultBreakpoint.highlightRange == expectedBreakpoint.highlightRange &&
|
||||
defaultBreakpoint.generalDescription == expectedBreakpoint.generalDescription) {
|
||||
// Added, removed and added again the same breakpoint, not our case.
|
||||
return@readAction
|
||||
}
|
||||
@@ -174,21 +176,13 @@ internal class BreakpointVariantPriorityTracker(private val coroutineScope: Coro
|
||||
}
|
||||
|
||||
@RequiresReadLock
|
||||
private fun <P1 : XBreakpointProperties<*>, P2 : XBreakpointProperties<*>> lookSimilar(b1: XLineBreakpoint<P1>, b2: XLineBreakpoint<P2>): Boolean {
|
||||
return b1.type == b2.type &&
|
||||
b1.type.getHighlightRange(b1) == b2.type.getHighlightRange(b2) &&
|
||||
b1.type.getGeneralDescription(b1) == b2.type.getGeneralDescription(b2)
|
||||
}
|
||||
|
||||
@RequiresReadLock
|
||||
private fun <P : XBreakpointProperties<*>> getDescription(fileUrl: String, b: XLineBreakpoint<P>): String {
|
||||
val t = b.type
|
||||
val kind = t.getGeneralDescription(b)
|
||||
val text = when (val range = t.getHighlightRange(b)) {
|
||||
private fun getDescription(fileUrl: String, b: XLineBreakpoint<*>): String {
|
||||
val kind = b.generalDescription
|
||||
val text = when (val range = b.highlightRange) {
|
||||
null -> "<whole line>"
|
||||
else -> readDocument(fileUrl) { it.getText(range) }
|
||||
}
|
||||
return "${t.id}, $kind: $text"
|
||||
return "${b.type.id}, $kind: $text"
|
||||
}
|
||||
|
||||
@RequiresReadLock
|
||||
|
||||
@@ -349,7 +349,7 @@ internal class InlineBreakpointInlayManager(private val project: Project, parent
|
||||
}
|
||||
|
||||
private fun breakpointHasTheBiggestRange(breakpoint: XLineBreakpointImpl<*>, variants: List<XLineBreakpointType<XBreakpointProperties<*>>.XLineBreakpointVariant>) : Boolean {
|
||||
val range = getBreakpointHighlightRange(breakpoint)
|
||||
val range = breakpoint.highlightRange
|
||||
if (range == null) {
|
||||
return true
|
||||
}
|
||||
@@ -376,18 +376,10 @@ internal class InlineBreakpointInlayManager(private val project: Project, parent
|
||||
}
|
||||
|
||||
private fun getBreakpointRangeStartOffset(breakpoint: XLineBreakpointImpl<*>, lineRange: IntRange): Int {
|
||||
val range = getBreakpointHighlightRange(breakpoint)
|
||||
val range = breakpoint.highlightRange
|
||||
return getBreakpointRangeStartNormalized(range, lineRange)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST") // Casts are required for gods of Kotlin-Java type inference.
|
||||
private fun getBreakpointHighlightRange(breakpoint: XLineBreakpointImpl<*>): TextRange? {
|
||||
val type: XLineBreakpointType<XBreakpointProperties<*>> = breakpoint.type as XLineBreakpointType<XBreakpointProperties<*>>
|
||||
val b = breakpoint as XLineBreakpoint<XBreakpointProperties<*>>
|
||||
|
||||
return type.getHighlightRange(b)
|
||||
}
|
||||
|
||||
private fun getBreakpointRangeStartNormalized(breakpointRange: TextRange?, lineRange: IntRange): Int {
|
||||
// Null range represents the whole line.
|
||||
return breakpointRange?.startOffset?.coerceIn(lineRange) ?: lineRange.first
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.editor.markup.GutterIconRenderer
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Pair
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.xdebugger.XDebuggerManager
|
||||
@@ -270,3 +271,7 @@ val XBreakpoint<*>.propertyXMLDescriptions: List<@Nls String>
|
||||
@Suppress("UNCHECKED_CAST") val t = type as XBreakpointType<XBreakpoint<*>, *>
|
||||
return t.getPropertyXMLDescriptions(this)
|
||||
}
|
||||
|
||||
val <P : XBreakpointProperties<*>> XLineBreakpoint<P>.highlightRange: TextRange?
|
||||
get() =
|
||||
type.getHighlightRange(this)
|
||||
|
||||
Reference in New Issue
Block a user