mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-122192 highlight usages should have highest priority
This commit is contained in:
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
@@ -95,6 +96,10 @@ public interface HighlightInfoType {
|
||||
HighlightInfoType INJECTED_LANGUAGE_FRAGMENT = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.INFORMATION_ATTRIBUTES);
|
||||
HighlightInfoType INJECTED_LANGUAGE_BACKGROUND = new HighlightInfoTypeImpl(INJECTED_FRAGMENT_SEVERITY, CodeInsightColors.INFORMATION_ATTRIBUTES);
|
||||
|
||||
HighlightSeverity ELEMENT_UNDER_CARET_SEVERITY = new HighlightSeverity("ELEMENT_UNDER_CARET", HighlightSeverity.ERROR.myVal + 1);
|
||||
HighlightInfoType ELEMENT_UNDER_CARET_READ = new HighlightInfoType.HighlightInfoTypeImpl(ELEMENT_UNDER_CARET_SEVERITY, EditorColors.IDENTIFIER_UNDER_CARET_ATTRIBUTES);
|
||||
HighlightInfoType ELEMENT_UNDER_CARET_WRITE = new HighlightInfoType.HighlightInfoTypeImpl(ELEMENT_UNDER_CARET_SEVERITY, EditorColors.WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES);
|
||||
|
||||
@NotNull
|
||||
HighlightSeverity getSeverity(@Nullable PsiElement psiElement);
|
||||
|
||||
|
||||
+3
@@ -426,6 +426,9 @@ public class UpdateHighlightersUtil {
|
||||
else if (severity == HighlightInfoType.INJECTED_FRAGMENT_SEVERITY) {
|
||||
layer = HighlighterLayer.CARET_ROW-1;
|
||||
}
|
||||
else if (severity == HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY) {
|
||||
layer = HighlighterLayer.SELECTION-1;
|
||||
}
|
||||
else {
|
||||
layer = HighlighterLayer.ADDITIONAL_SYNTAX;
|
||||
}
|
||||
|
||||
+4
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -26,11 +26,9 @@ import com.intellij.find.FindManager;
|
||||
import com.intellij.find.findUsages.FindUsagesHandler;
|
||||
import com.intellij.find.findUsages.FindUsagesManager;
|
||||
import com.intellij.find.impl.FindManagerImpl;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.impl.DocumentMarkupModel;
|
||||
import com.intellij.openapi.editor.markup.MarkupModel;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
@@ -59,9 +57,6 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
|
||||
private final Collection<TextRange> myWriteAccessRanges = Collections.synchronizedList(new ArrayList<TextRange>());
|
||||
private final int myCaretOffset;
|
||||
|
||||
private static final HighlightInfoType ourReadHighlightInfoType = new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, EditorColors.IDENTIFIER_UNDER_CARET_ATTRIBUTES);
|
||||
private static final HighlightInfoType ourWriteHighlightInfoType = new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, EditorColors.WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES);
|
||||
|
||||
protected IdentifierHighlighterPass(final Project project, final PsiFile file, final Editor editor) {
|
||||
super(project, editor.getDocument(), false);
|
||||
myFile = file;
|
||||
@@ -167,10 +162,10 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
|
||||
|
||||
List<HighlightInfo> result = new ArrayList<HighlightInfo>(myReadAccessRanges.size() + myWriteAccessRanges.size());
|
||||
for (TextRange range: myReadAccessRanges) {
|
||||
ContainerUtil.addIfNotNull(createHighlightInfo(range, ourReadHighlightInfoType, existingMarkupTooltips), result);
|
||||
ContainerUtil.addIfNotNull(createHighlightInfo(range, HighlightInfoType.ELEMENT_UNDER_CARET_READ, existingMarkupTooltips), result);
|
||||
}
|
||||
for (TextRange range: myWriteAccessRanges) {
|
||||
ContainerUtil.addIfNotNull(createHighlightInfo(range, ourWriteHighlightInfoType, existingMarkupTooltips), result);
|
||||
ContainerUtil.addIfNotNull(createHighlightInfo(range, HighlightInfoType.ELEMENT_UNDER_CARET_WRITE, existingMarkupTooltips), result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -194,7 +189,7 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
|
||||
continue;
|
||||
}
|
||||
HighlightInfo info = (HighlightInfo)tooltip;
|
||||
if (info.type == ourReadHighlightInfoType || info.type == ourWriteHighlightInfoType) {
|
||||
if (info.type == HighlightInfoType.ELEMENT_UNDER_CARET_READ || info.type == HighlightInfoType.ELEMENT_UNDER_CARET_WRITE) {
|
||||
highlighter.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user