mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restored limitation to line for java-related highlighters - IDEA-CR-31880
This commit is contained in:
@@ -860,10 +860,21 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
@Nullable
|
||||
@Override
|
||||
public TextRange getHighlightRange() {
|
||||
return SourcePositionHighlighter.getHighlightRangeFor(mySourcePosition);
|
||||
return intersectWithLine(SourcePositionHighlighter.getHighlightRangeFor(mySourcePosition), mySourcePosition.getFile(), getLine());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TextRange intersectWithLine(@Nullable TextRange range, @Nullable PsiFile file, int line) {
|
||||
if (range != null && file != null) {
|
||||
Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
|
||||
if (document != null) {
|
||||
range = range.intersection(DocumentUtil.getLineTextRange(document, line));
|
||||
}
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiFile getPsiFile(@Nullable XSourcePosition position, Project project) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
|
||||
+5
-2
@@ -190,7 +190,10 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
|
||||
@Override
|
||||
public TextRange getHighlightRange() {
|
||||
return myElement != null ? myElement.getTextRange() : null;
|
||||
if (myElement != null) {
|
||||
return DebuggerUtilsEx.intersectWithLine(myElement.getTextRange(), myElement.getContainingFile(), mySourcePosition.getLine());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -239,7 +242,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
if (javaBreakpoint instanceof LineBreakpoint) {
|
||||
PsiElement method = getContainingMethod((LineBreakpoint)javaBreakpoint);
|
||||
if (method != null) {
|
||||
return method.getTextRange();
|
||||
return DebuggerUtilsEx.intersectWithLine(method.getTextRange(), method.getContainingFile(), breakpoint.getLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user