mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Do not show intention bulb when a fix range collapses (IDEA-114727)
This commit is contained in:
@@ -44,6 +44,7 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Segment;
|
||||
import com.intellij.psi.IntentionFilterOwner;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -94,19 +95,19 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass {
|
||||
@NotNull List<HighlightInfo.IntentionActionDescriptor> outList,
|
||||
int group,
|
||||
int offset) {
|
||||
if (info.quickFixActionMarkers == null) return;
|
||||
if (info.quickFixActionMarkers == null || info.getFixTextRange().isEmpty()) return;
|
||||
if (group != -1 && group != info.getGroup()) return;
|
||||
Editor injectedEditor = null;
|
||||
PsiFile injectedFile = null;
|
||||
for (Pair<HighlightInfo.IntentionActionDescriptor, RangeMarker> pair : info.quickFixActionMarkers) {
|
||||
HighlightInfo.IntentionActionDescriptor actionInGroup = pair.first;
|
||||
RangeMarker range = pair.second;
|
||||
if (!range.isValid()) continue;
|
||||
if (!range.isValid() || isEmpty(range)) continue;
|
||||
|
||||
if (DumbService.isDumb(file.getProject()) && !DumbService.isDumbAware(actionInGroup.getAction())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
int start = range.getStartOffset();
|
||||
int end = range.getEndOffset();
|
||||
final Project project = file.getProject();
|
||||
@@ -133,6 +134,10 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEmpty(@NotNull Segment segment) {
|
||||
return segment.getEndOffset() <= segment.getStartOffset();
|
||||
}
|
||||
|
||||
public static class IntentionsInfo {
|
||||
public final List<HighlightInfo.IntentionActionDescriptor> intentionsToShow = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
public final List<HighlightInfo.IntentionActionDescriptor> errorFixesToShow = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
|
||||
Reference in New Issue
Block a user