mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Reverted: Semantic highlighting level to avoid conflicts with "unused symbol" annotations [CR-IC-2435]
This commit is contained in:
@@ -34,8 +34,6 @@ public class HighlightSeverity implements Comparable<HighlightSeverity>, JDOMExt
|
||||
public String myName;
|
||||
public int myVal;
|
||||
|
||||
public static final HighlightSeverity SEMANTIC = new HighlightSeverity("SEMANTIC", 5);
|
||||
|
||||
/**
|
||||
* The standard severity level for information annotations.
|
||||
*/
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.intellij.lang.annotation;
|
||||
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Allows to crate semantic annotations to highlight similar PSI elements differently depending on their actual meaning. For example,
|
||||
* static members vs. instance fields and etc. Semantic annotations have lower highlighting level than infos, weak warnings etc. but
|
||||
* higher than regular syntax.
|
||||
*
|
||||
* @author Rustam Vishnyakov
|
||||
*/
|
||||
public interface SemanticAnnotationHolder extends AnnotationHolder {
|
||||
|
||||
/**
|
||||
* Creates annotation with a semantic highlighting level.
|
||||
*
|
||||
* @param range The text range over which the annotation is created.
|
||||
* @param attributesKey The attributes key to use for the annotation.
|
||||
* @return the annotation (which can be modified to set additional annotation parameters).
|
||||
*/
|
||||
Annotation createSemanticAnnotation(@NotNull TextRange range, @NotNull TextAttributesKey attributesKey);
|
||||
}
|
||||
+5
-14
@@ -17,10 +17,11 @@
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.annotation.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.lang.annotation.Annotation;
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import com.intellij.lang.annotation.AnnotationSession;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -35,12 +36,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class AnnotationHolderImpl extends SmartList<Annotation> implements SemanticAnnotationHolder {
|
||||
public class AnnotationHolderImpl extends SmartList<Annotation> implements AnnotationHolder {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl");
|
||||
private final AnnotationSession myAnnotationSession;
|
||||
|
||||
private final static boolean isUnitTestMode = ApplicationManager.getApplication().isUnitTestMode();
|
||||
|
||||
private final boolean myBatchMode;
|
||||
|
||||
public AnnotationHolderImpl(@NotNull AnnotationSession session) {
|
||||
@@ -158,12 +157,4 @@ public class AnnotationHolderImpl extends SmartList<Annotation> implements Seman
|
||||
public AnnotationSession getCurrentAnnotationSession() {
|
||||
return myAnnotationSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Annotation createSemanticAnnotation(@NotNull TextRange range, @NotNull TextAttributesKey key) {
|
||||
String description = isUnitTestMode ? key.getExternalName() : null;
|
||||
Annotation annotation = createAnnotation(range, HighlightSeverity.SEMANTIC, description);
|
||||
annotation.setTextAttributes(key);
|
||||
return annotation;
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -423,9 +423,6 @@ public class UpdateHighlightersUtil {
|
||||
else if (severity == HighlightInfoType.INJECTED_FRAGMENT_SEVERITY) {
|
||||
layer = HighlighterLayer.CARET_ROW-1;
|
||||
}
|
||||
else if (severity == HighlightSeverity.SEMANTIC) {
|
||||
layer = HighlighterLayer.SEMANTIC;
|
||||
}
|
||||
else {
|
||||
layer = HighlighterLayer.ADDITIONAL_SYNTAX;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.openapi.editor.markup;
|
||||
public interface HighlighterLayer {
|
||||
int CARET_ROW = 1000;
|
||||
int SYNTAX = 2000;
|
||||
int SEMANTIC = 2500;
|
||||
int ADDITIONAL_SYNTAX = 3000;
|
||||
int GUARDED_BLOCKS = 3500;
|
||||
int WARNING = 4000;
|
||||
|
||||
@@ -72,7 +72,6 @@ public class ExpectedHighlightingData {
|
||||
@NonNls private static final String END_LINE_HIGHLIGHT_MARKER = "EOLError";
|
||||
@NonNls private static final String END_LINE_WARNING_MARKER = "EOLWarning";
|
||||
@NonNls private static final String LINE_MARKER = "lineMarker";
|
||||
@NonNls private static final String SEMANTIC_MARKER = "semantic";
|
||||
|
||||
@NotNull private final Document myDocument;
|
||||
private final PsiFile myFile;
|
||||
@@ -134,7 +133,6 @@ public class ExpectedHighlightingData {
|
||||
highlightingTypes.put("inject", new ExpectedHighlightingSet(HighlightInfoType.INJECTED_FRAGMENT_SEVERITY, false, checkInfos));
|
||||
highlightingTypes.put(INFO_MARKER, new ExpectedHighlightingSet(HighlightSeverity.INFORMATION, false, checkInfos));
|
||||
highlightingTypes.put("symbolName", new ExpectedHighlightingSet(HighlightInfoType.SYMBOL_TYPE_SEVERITY, false, false));
|
||||
highlightingTypes.put(SEMANTIC_MARKER, new ExpectedHighlightingSet(HighlightSeverity.SEMANTIC, false, false));
|
||||
for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
|
||||
for (HighlightInfoType type : provider.getSeveritiesHighlightInfoTypes()) {
|
||||
final HighlightSeverity severity = type.getSeverity(null);
|
||||
@@ -175,10 +173,6 @@ public class ExpectedHighlightingData {
|
||||
highlightingTypes.put("symbolName", new ExpectedHighlightingSet(HighlightInfoType.SYMBOL_TYPE_SEVERITY, false, true));
|
||||
}
|
||||
|
||||
public void checkSemantics() {
|
||||
highlightingTypes.put(SEMANTIC_MARKER, new ExpectedHighlightingSet(HighlightSeverity.SEMANTIC, false, true));
|
||||
}
|
||||
|
||||
private void refreshLineMarkers() {
|
||||
for (Map.Entry<RangeMarker, LineMarkerInfo> entry : lineMarkerInfos.entrySet()) {
|
||||
RangeMarker rangeMarker = entry.getKey();
|
||||
|
||||
-6
@@ -252,12 +252,6 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
|
||||
*/
|
||||
long testHighlighting(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @TestDataFile @NonNls String... filePaths);
|
||||
|
||||
long testHighlighting(boolean checkWarnings,
|
||||
boolean checkInfos,
|
||||
boolean checkWeakWarnings,
|
||||
boolean checkSemantics,
|
||||
@TestDataFile @NonNls String... filePaths);
|
||||
|
||||
long testHighlightingAllFiles(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @TestDataFile @NonNls String... filePaths);
|
||||
|
||||
long testHighlightingAllFiles(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @TestDataFile @NonNls VirtualFile... files);
|
||||
|
||||
+2
-19
@@ -326,21 +326,11 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
final boolean checkInfos,
|
||||
final boolean checkWeakWarnings,
|
||||
final String... filePaths) {
|
||||
return testHighlighting(checkWarnings, checkInfos, checkWeakWarnings, false, filePaths);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long testHighlighting(boolean checkWarnings,
|
||||
boolean checkInfos,
|
||||
boolean checkWeakWarnings,
|
||||
boolean checkSemantics,
|
||||
@TestDataFile @NonNls String... filePaths) {
|
||||
if (filePaths.length > 0) {
|
||||
configureByFilesInner(filePaths);
|
||||
}
|
||||
try {
|
||||
return collectAndCheckHighlighting(checkWarnings, checkInfos, checkWeakWarnings, checkSemantics);
|
||||
return collectAndCheckHighlighting(checkWarnings, checkInfos, checkWeakWarnings);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -1419,14 +1409,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
}
|
||||
|
||||
private long collectAndCheckHighlighting(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings) throws Exception {
|
||||
return collectAndCheckHighlighting(checkWarnings, checkInfos, checkWeakWarnings, false);
|
||||
}
|
||||
|
||||
private long collectAndCheckHighlighting(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, boolean checkSemantics)
|
||||
throws Exception {
|
||||
ExpectedHighlightingData data =
|
||||
new ExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, getHostFile());
|
||||
if (checkSemantics) data.checkSemantics();
|
||||
ExpectedHighlightingData data = new ExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, getHostFile());
|
||||
data.init();
|
||||
return collectAndCheckHighlighting(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user