mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[java] text block literals: feature highlighting (IDEA-215312)
GitOrigin-RevId: c821907a3b48fcbe19f6d9409b87ce1a4bc3dc50
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fceeaf25e8
commit
d08658cd55
+1
@@ -3095,6 +3095,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
MODULES(LanguageLevel.JDK_1_9, "feature.modules"),
|
||||
ENHANCED_SWITCH(LanguageLevel.JDK_12_PREVIEW, "feature.enhanced.switch"),
|
||||
SWITCH_EXPRESSION(LanguageLevel.JDK_12_PREVIEW, "feature.switch.expressions"),
|
||||
TEXT_BLOCKS(LanguageLevel.JDK_X, "feature.text.blocks"),
|
||||
RAW_LITERALS(LanguageLevel.JDK_X, "feature.raw.literals");
|
||||
|
||||
private final LanguageLevel level;
|
||||
|
||||
+7
-2
@@ -37,6 +37,7 @@ import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.infos.MethodCandidateInfo;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTagValue;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.*;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.MostlySingularMultiMap;
|
||||
@@ -467,9 +468,13 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
@Override
|
||||
public void visitJavaToken(PsiJavaToken token) {
|
||||
super.visitJavaToken(token);
|
||||
if (!myHolder.hasErrorResults() && token.getTokenType() == JavaTokenType.RAW_STRING_LITERAL) {
|
||||
myHolder.add(checkFeature(token, Feature.RAW_LITERALS));
|
||||
|
||||
if (!myHolder.hasErrorResults()) {
|
||||
IElementType type = token.getTokenType();
|
||||
if (type == JavaTokenType.TEXT_BLOCK_LITERAL) myHolder.add(checkFeature(token, Feature.TEXT_BLOCKS));
|
||||
if (type == JavaTokenType.RAW_STRING_LITERAL) myHolder.add(checkFeature(token, Feature.RAW_LITERALS));
|
||||
}
|
||||
|
||||
if (!myHolder.hasErrorResults() && token.getTokenType() == JavaTokenType.RBRACE && token.getParent() instanceof PsiCodeBlock) {
|
||||
PsiElement gParent = token.getParent().getParent();
|
||||
PsiCodeBlock codeBlock;
|
||||
|
||||
@@ -485,6 +485,7 @@ feature.intersections.in.casts=Intersection types in casts
|
||||
feature.static.interface.calls=Static interface method calls
|
||||
feature.try.with.resources.refs=Resource references
|
||||
feature.modules=Modules
|
||||
feature.text.blocks=Text block literals
|
||||
feature.raw.literals=Raw string literals
|
||||
feature.enhanced.switch=Enhanced 'switch' blocks
|
||||
feature.switch.expressions='switch' expressions
|
||||
|
||||
+1
-1
@@ -21,6 +21,6 @@ class UnsupportedFeatures {
|
||||
java.lang.annotation.ElementType t = null;
|
||||
switch (<error descr="Incompatible types. Found: 'java.lang.annotation.ElementType', required: 'byte, char, short or int'">t</error>) { }
|
||||
|
||||
String raw = <error descr="Raw string literals are not supported at language level '1.4'">`hi there`</error>;
|
||||
String raw = <error descr="Text block literals are not supported at language level '1.4'">"""hi there"""</error>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user