mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+90
-43
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.java19api;
|
||||
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.ex.BaseLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.controlFlow.DefUseUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -27,16 +27,16 @@ import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.siyeh.ig.callMatcher.CallMapper;
|
||||
import com.siyeh.ig.callMatcher.CallMatcher;
|
||||
import com.siyeh.ig.psiutils.ClassUtils;
|
||||
import com.siyeh.ig.psiutils.CommentTracker;
|
||||
import com.siyeh.ig.psiutils.ConstructionUtils;
|
||||
import com.siyeh.ig.psiutils.MethodCallUtils;
|
||||
import com.siyeh.ig.psiutils.*;
|
||||
import one.util.streamex.IntStreamEx;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.intellij.util.ObjectUtils.tryCast;
|
||||
|
||||
@@ -46,12 +46,16 @@ import static com.intellij.util.ObjectUtils.tryCast;
|
||||
public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
private static final CallMatcher UNMODIFIABLE_SET =
|
||||
CallMatcher.staticCall(CommonClassNames.JAVA_UTIL_COLLECTIONS, "unmodifiableSet").parameterCount(1);
|
||||
private static final CallMatcher UNMODIFIABLE_MAP =
|
||||
CallMatcher.staticCall(CommonClassNames.JAVA_UTIL_COLLECTIONS, "unmodifiableMap").parameterCount(1);
|
||||
private static final CallMatcher UNMODIFIABLE_LIST =
|
||||
CallMatcher.staticCall(CommonClassNames.JAVA_UTIL_COLLECTIONS, "unmodifiableList").parameterCount(1);
|
||||
private static final CallMatcher ARRAYS_AS_LIST =
|
||||
CallMatcher.staticCall(CommonClassNames.JAVA_UTIL_ARRAYS, "asList");
|
||||
private static final CallMatcher COLLECTION_ADD =
|
||||
CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_COLLECTION, "add").parameterCount(1);
|
||||
private static final CallMatcher MAP_PUT =
|
||||
CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_MAP, "put").parameterCount(2);
|
||||
private static final CallMatcher STREAM_COLLECT =
|
||||
CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_STREAM_STREAM, "collect").parameterCount(1);
|
||||
private static final CallMatcher STREAM_OF =
|
||||
@@ -63,8 +67,18 @@ public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
|
||||
private static final CallMapper<PrepopulatedCollectionModel> MAPPER = new CallMapper<PrepopulatedCollectionModel>()
|
||||
.register(UNMODIFIABLE_SET, call -> PrepopulatedCollectionModel.fromSet(call.getArgumentList().getExpressions()[0]))
|
||||
.register(UNMODIFIABLE_MAP, call -> PrepopulatedCollectionModel.fromMap(call.getArgumentList().getExpressions()[0]))
|
||||
.register(UNMODIFIABLE_LIST, call -> PrepopulatedCollectionModel.fromList(call.getArgumentList().getExpressions()[0]));
|
||||
|
||||
public boolean IGNORE_NON_CONSTANT = false;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel(InspectionsBundle.message("inspection.collection.factories.option.ignore.non.constant"), this,
|
||||
"IGNORE_NON_CONSTANT");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
|
||||
@@ -75,10 +89,17 @@ public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
@Override
|
||||
public void visitMethodCallExpression(PsiMethodCallExpression call) {
|
||||
PrepopulatedCollectionModel model = MAPPER.mapFirst(call);
|
||||
if(model != null) {
|
||||
PsiElement element = call.getMethodExpression().getReferenceNameElement();
|
||||
if (model != null && model.isValid()) {
|
||||
ProblemHighlightType type = model.myConstantContent || !IGNORE_NON_CONSTANT
|
||||
? ProblemHighlightType.GENERIC_ERROR_OR_WARNING
|
||||
: ProblemHighlightType.INFORMATION;
|
||||
if (type == ProblemHighlightType.INFORMATION && !isOnTheFly) return;
|
||||
boolean wholeStatement = isOnTheFly &&
|
||||
(type == ProblemHighlightType.INFORMATION ||
|
||||
InspectionProjectProfileManager.isInformationLevel(getShortName(), call));
|
||||
PsiElement element = wholeStatement ? call : call.getMethodExpression().getReferenceNameElement();
|
||||
if(element != null) {
|
||||
holder.registerProblem(element, "Can be replaced with '"+model.myType+".of' call",
|
||||
holder.registerProblem(element, InspectionsBundle.message("inspection.collection.factories.message", model.myType), type,
|
||||
new ReplaceWithCollectionFactoryFix(model.myType));
|
||||
}
|
||||
}
|
||||
@@ -90,11 +111,35 @@ public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
final List<PsiExpression> myContent;
|
||||
final List<PsiElement> myElementsToDelete;
|
||||
final String myType;
|
||||
final boolean myConstantContent;
|
||||
final boolean myRepeatingKeys;
|
||||
final boolean myHasNulls;
|
||||
|
||||
PrepopulatedCollectionModel(List<PsiExpression> content, List<PsiElement> delete, String type) {
|
||||
myContent = content;
|
||||
myElementsToDelete = delete;
|
||||
myType = type;
|
||||
Map<PsiExpression, List<Object>> constants = StreamEx.of(myContent)
|
||||
.cross(ExpressionUtils::possibleValues).mapValues(ExpressionUtils::computeConstantExpression).distinct().grouping();
|
||||
myConstantContent = StreamEx.ofValues(constants).flatCollection(Function.identity()).allMatch(Objects::nonNull);
|
||||
myRepeatingKeys = keyExpressions().flatCollection(constants::get).nonNull().distinct(2).findAny().isPresent();
|
||||
myHasNulls = StreamEx.of(myContent).flatMap(ExpressionUtils::possibleValues).map(PsiExpression::getType).has(PsiType.NULL);
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
boolean mapOfTooManyParameters = myType.equals("Map") && myContent.size() > 20;
|
||||
return !myHasNulls && !myRepeatingKeys && !mapOfTooManyParameters;
|
||||
}
|
||||
|
||||
private StreamEx<PsiExpression> keyExpressions() {
|
||||
switch (myType) {
|
||||
case "Set":
|
||||
return StreamEx.of(myContent);
|
||||
case "Map":
|
||||
return IntStreamEx.range(0, myContent.size(), 2).elements(myContent);
|
||||
default:
|
||||
return StreamEx.empty();
|
||||
}
|
||||
}
|
||||
|
||||
public static PrepopulatedCollectionModel fromList(PsiExpression listDefinition) {
|
||||
@@ -104,54 +149,56 @@ public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
if (ARRAYS_AS_LIST.test(call)) {
|
||||
return new PrepopulatedCollectionModel(Arrays.asList(call.getArgumentList().getExpressions()), Collections.emptyList(), "List");
|
||||
}
|
||||
if(STREAM_COLLECT.test(call) && COLLECTORS_TO_LIST.matches(call.getArgumentList().getExpressions()[0])) {
|
||||
PsiMethodCallExpression qualifier = MethodCallUtils.getQualifierMethodCall(call);
|
||||
if(STREAM_OF.matches(qualifier)) {
|
||||
return new PrepopulatedCollectionModel(Arrays.asList(qualifier.getArgumentList().getExpressions()), Collections.emptyList(),
|
||||
"List");
|
||||
}
|
||||
}
|
||||
return fromCollect(call, "List", COLLECTORS_TO_LIST);
|
||||
}
|
||||
if(listDefinition instanceof PsiNewExpression) {
|
||||
return fromNewExpression((PsiNewExpression)listDefinition, "List", CommonClassNames.JAVA_UTIL_ARRAY_LIST);
|
||||
}
|
||||
if (listDefinition instanceof PsiReferenceExpression) {
|
||||
PsiLocalVariable variable = tryCast(((PsiReferenceExpression)listDefinition).resolve(), PsiLocalVariable.class);
|
||||
if (variable != null) {
|
||||
return fromVariable(variable, listDefinition, "List", CommonClassNames.JAVA_UTIL_ARRAY_LIST);
|
||||
}
|
||||
return fromVariable((PsiReferenceExpression)listDefinition, "List", CommonClassNames.JAVA_UTIL_ARRAY_LIST, COLLECTION_ADD);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrepopulatedCollectionModel fromSet(PsiExpression setDefinition) {
|
||||
setDefinition = PsiUtil.skipParenthesizedExprDown(setDefinition);
|
||||
if(setDefinition instanceof PsiNewExpression) {
|
||||
if (setDefinition instanceof PsiMethodCallExpression) {
|
||||
return fromCollect((PsiMethodCallExpression)setDefinition, "Set", COLLECTORS_TO_SET);
|
||||
}
|
||||
if (setDefinition instanceof PsiNewExpression) {
|
||||
return fromNewExpression((PsiNewExpression)setDefinition, "Set", CommonClassNames.JAVA_UTIL_HASH_SET);
|
||||
}
|
||||
if(setDefinition instanceof PsiMethodCallExpression) {
|
||||
PsiMethodCallExpression call = (PsiMethodCallExpression)setDefinition;
|
||||
if(STREAM_COLLECT.test(call) && COLLECTORS_TO_SET.matches(call.getArgumentList().getExpressions()[0])) {
|
||||
PsiMethodCallExpression qualifier = MethodCallUtils.getQualifierMethodCall(call);
|
||||
if(STREAM_OF.matches(qualifier)) {
|
||||
return new PrepopulatedCollectionModel(Arrays.asList(qualifier.getArgumentList().getExpressions()), Collections.emptyList(),
|
||||
"Set");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (setDefinition instanceof PsiReferenceExpression) {
|
||||
PsiLocalVariable variable = tryCast(((PsiReferenceExpression)setDefinition).resolve(), PsiLocalVariable.class);
|
||||
if (variable != null) {
|
||||
return fromVariable(variable, setDefinition, "Set", CommonClassNames.JAVA_UTIL_HASH_SET);
|
||||
return fromVariable((PsiReferenceExpression)setDefinition, "Set", CommonClassNames.JAVA_UTIL_HASH_SET, COLLECTION_ADD);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrepopulatedCollectionModel fromMap(PsiExpression mapDefinition) {
|
||||
mapDefinition = PsiUtil.skipParenthesizedExprDown(mapDefinition);
|
||||
if (mapDefinition instanceof PsiReferenceExpression) {
|
||||
return fromVariable((PsiReferenceExpression)mapDefinition, "Map", CommonClassNames.JAVA_UTIL_HASH_MAP, MAP_PUT);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PrepopulatedCollectionModel fromCollect(PsiMethodCallExpression call, String typeName, CallMatcher collector) {
|
||||
if (STREAM_COLLECT.test(call) && collector.matches(call.getArgumentList().getExpressions()[0])) {
|
||||
PsiMethodCallExpression qualifier = MethodCallUtils.getQualifierMethodCall(call);
|
||||
if (STREAM_OF.matches(qualifier)) {
|
||||
return new PrepopulatedCollectionModel(Arrays.asList(qualifier.getArgumentList().getExpressions()), Collections.emptyList(),
|
||||
typeName);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PrepopulatedCollectionModel fromVariable(PsiLocalVariable variable,
|
||||
PsiExpression expression,
|
||||
String typeName, String collectionClass) {
|
||||
private static PrepopulatedCollectionModel fromVariable(PsiReferenceExpression expression,
|
||||
String typeName, String collectionClass, CallMatcher addMethod) {
|
||||
PsiLocalVariable variable = tryCast(expression.resolve(), PsiLocalVariable.class);
|
||||
if (variable == null) return null;
|
||||
PsiCodeBlock block = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class);
|
||||
PsiDeclarationStatement declaration = PsiTreeUtil.getParentOfType(variable, PsiDeclarationStatement.class);
|
||||
if (block == null || declaration == null) return null;
|
||||
@@ -172,9 +219,9 @@ public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
if (PsiTreeUtil.isAncestor(cur, expression, false)) break;
|
||||
if (!(cur instanceof PsiExpressionStatement)) return null;
|
||||
PsiMethodCallExpression call = tryCast(((PsiExpressionStatement)cur).getExpression(), PsiMethodCallExpression.class);
|
||||
if (!COLLECTION_ADD.test(call)) return null;
|
||||
if (!addMethod.test(call)) return null;
|
||||
if (!refs.remove(call.getMethodExpression().getQualifierExpression())) return null;
|
||||
contents.add(call.getArgumentList().getExpressions()[0]);
|
||||
contents.addAll(Arrays.asList(call.getArgumentList().getExpressions()));
|
||||
elementsToRemove.add(cur);
|
||||
}
|
||||
if (!refs.isEmpty()) return null;
|
||||
@@ -242,19 +289,19 @@ public class Java9CollectionFactoryInspection extends BaseLocalInspectionTool {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Replace with '"+myType+".of' call";
|
||||
return InspectionsBundle.message("inspection.collection.factories.fix.name", myType);
|
||||
}
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Replace with collection factory call";
|
||||
return InspectionsBundle.message("inspection.collection.factories.fix.family.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PsiMethodCallExpression call = PsiTreeUtil.getParentOfType(descriptor.getStartElement(), PsiMethodCallExpression.class);
|
||||
PsiMethodCallExpression call = PsiTreeUtil.getParentOfType(descriptor.getStartElement(), PsiMethodCallExpression.class, false);
|
||||
if(call == null) return;
|
||||
PrepopulatedCollectionModel model = MAPPER.mapFirst(call);
|
||||
if(model == null) return;
|
||||
|
||||
@@ -194,14 +194,7 @@ public class PsiEnumConstantImpl extends JavaStubPsiElement<PsiFieldStub> implem
|
||||
|
||||
@Override
|
||||
public boolean isDeprecated() {
|
||||
final PsiFieldStub stub = getGreenStub();
|
||||
if (stub != null) {
|
||||
return stub.isDeprecated();
|
||||
}
|
||||
|
||||
PsiDocComment docComment = getDocComment();
|
||||
return docComment != null && docComment.findTagByName("deprecated") != null ||
|
||||
getModifierList().findAnnotation("java.lang.Deprecated") != null;
|
||||
return PsiFieldImpl.isFieldDeprecated(this, getGreenStub());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -299,12 +299,15 @@ public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements Ps
|
||||
|
||||
@Override
|
||||
public boolean isDeprecated() {
|
||||
final PsiFieldStub stub = getGreenStub();
|
||||
return isFieldDeprecated(this, getGreenStub());
|
||||
}
|
||||
|
||||
static boolean isFieldDeprecated(@NotNull PsiField field, @Nullable PsiFieldStub stub) {
|
||||
if (stub != null) {
|
||||
return stub.isDeprecated() || stub.hasDeprecatedAnnotation() && PsiImplUtil.isDeprecatedByAnnotation(this);
|
||||
return stub.isDeprecated() || stub.hasDeprecatedAnnotation() && PsiImplUtil.isDeprecatedByAnnotation(field);
|
||||
}
|
||||
|
||||
return PsiImplUtil.isDeprecatedByDocTag(this) || PsiImplUtil.isDeprecatedByAnnotation(this);
|
||||
return PsiImplUtil.isDeprecatedByDocTag(field) || PsiImplUtil.isDeprecatedByAnnotation(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,5 +4,5 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static final List<Number> EVEN = List.of(2, 4, 6, 8, 10);
|
||||
public static final List<Number> EVEN = List.of(2, 4, 6, 8, 10, 2);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Map.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap;
|
||||
myMap = Map.of("a", "1", "b", "1", "c", "1", "d", "1", "e", "1", "f", "1", "g", "1", "h", "1", "i", "1", "j", "1");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Map.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap;
|
||||
myMap = Map.of("a", "b", "c", "b");
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,5 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Test {
|
||||
public static final Set<String> MY_SET = Set.of("a", "b", "c");
|
||||
public static final Set<String> MY_SET = Set.of("a", "b", "c", Math.random() > 0.5 ? "d" : Math.random() > 0.5 ? "e" : "d");
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Set.of' call" "false"
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Test {
|
||||
static final String CONST = "b";
|
||||
|
||||
public static final Set<String> MY_SET = Set.of("a", "b", "c", CONST);
|
||||
}
|
||||
@@ -4,5 +4,5 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static final List<Number> EVEN = Collections.unmodi<caret>fiableList(Arrays.asList(2,4,6,8,10));
|
||||
public static final List<Number> EVEN = Collections.unmodi<caret>fiableList(Arrays.asList(2,4,6,8,10,2));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'List.of' call" "false"
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static final List<Number> EVEN = Collections.unmodi<caret>fiableList(Arrays.asList(2,4,6,8,10,Math.random() > 0.5 ? 12 : null));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// "Replace with 'Map.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap = new HashMap<>();
|
||||
myMap.put("a", "1");
|
||||
myMap.put("b", "1");
|
||||
myMap.put("c", "1");
|
||||
myMap.put("d", "1");
|
||||
myMap.put("e", "1");
|
||||
myMap.put("f", "1");
|
||||
myMap.put("g", "1");
|
||||
myMap.put("h", "1");
|
||||
myMap.put("i", "1");
|
||||
myMap.put("j", "1");
|
||||
myMap = Collections.unmodifia<caret>bleMap(myMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Replace with 'Map.of' call" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap = new HashMap<>();
|
||||
myMap.put("a", "1");
|
||||
myMap.put("b", "1");
|
||||
myMap.put("c", "1");
|
||||
myMap.put("d", "1");
|
||||
myMap.put("e", "1");
|
||||
myMap.put("f", "1");
|
||||
myMap.put("g", "1");
|
||||
myMap.put("h", "1");
|
||||
myMap.put("i", "1");
|
||||
myMap.put("j", "1");
|
||||
myMap.put("k", "1");
|
||||
myMap = Collections.unmodifia<caret>bleMap(myMap);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Map.of' call" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap = new HashMap<>();
|
||||
myMap.put("a", "b");
|
||||
myMap.put("a", "c");
|
||||
myMap = Collections.unmo<caret>difiableMap(myMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Map.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test() {
|
||||
Map<String, String> myMap = new HashMap<>();
|
||||
myMap.put("a", "b");
|
||||
myMap.put("c", "b");
|
||||
myMap = Collections.unmo<caret>difiableMap(myMap);
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,5 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Test {
|
||||
public static final Set<String> MY_SET = Collections.unm<caret>odifiableSet(new HashSet<>(Arrays.asList("a", "b", "c")));
|
||||
public static final Set<String> MY_SET = Collections.unm<caret>odifiableSet(new HashSet<>(Arrays.asList("a", "b", "c", Math.random() > 0.5 ? "d" : Math.random() > 0.5 ? "e" : "d")));
|
||||
}
|
||||
|
||||
@@ -159,4 +159,15 @@ import java.lang.annotation.*;
|
||||
assert list.parametersCount == list.parameters.size()
|
||||
}
|
||||
|
||||
void "test deprecated enum constant"() {
|
||||
def cls = myFixture.addClass("enum Foo { c1, @Deprecated c2, /** @deprecated */ c3 }")
|
||||
assert !((PsiFileImpl) cls.containingFile).contentsLoaded
|
||||
|
||||
assert !cls.fields[0].deprecated
|
||||
assert cls.fields[1].deprecated
|
||||
assert cls.fields[2].deprecated
|
||||
|
||||
assert !((PsiFileImpl) cls.containingFile).contentsLoaded
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,6 +49,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -119,7 +120,7 @@ public abstract class InspectionTestCase extends PsiTestCase {
|
||||
final String testDir = getTestDataPath() + "/" + folderName;
|
||||
GlobalInspectionContextImpl context = runTool(testDir, jdkName, runDeadCodeFirst, toolWrapper, additional);
|
||||
|
||||
InspectionTestUtil.compareToolResults(context, toolWrapper, checkRange, testDir);
|
||||
InspectionTestUtil.compareToolResults(context, checkRange, testDir, ContainerUtil.append(Collections.singletonList(toolWrapper), additional));
|
||||
}
|
||||
|
||||
protected void runTool(@NonNls @NotNull String testDir, @NonNls final String jdkName, @NotNull InspectionToolWrapper tool) {
|
||||
|
||||
+7
-1
@@ -91,6 +91,12 @@ public class GlobalInspectionToolWrapper extends InspectionToolWrapper<GlobalIns
|
||||
return null;
|
||||
}
|
||||
//noinspection TestOnlyProblems
|
||||
return new LocalInspectionToolWrapper(sharedTool);
|
||||
return new LocalInspectionToolWrapper(sharedTool){
|
||||
@Nullable
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return GlobalInspectionToolWrapper.this.getLanguage(); // inherit "language=" xml tag from the global inspection EP
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,9 @@ public abstract class PsiDocumentManager {
|
||||
/**
|
||||
* Commits (updates the PSI tree for) all modified but not committed documents.
|
||||
* Before a modified document is committed, accessing its PSI may return elements
|
||||
* corresponding to original (unmodified) state of the document.
|
||||
* corresponding to original (unmodified) state of the document.<p/>
|
||||
*
|
||||
* Should be called in UI thread in a write-safe context (see {@link com.intellij.openapi.application.TransactionGuard})
|
||||
*/
|
||||
public abstract void commitAllDocuments();
|
||||
|
||||
@@ -100,7 +102,11 @@ public abstract class PsiDocumentManager {
|
||||
/**
|
||||
* Updates the PSI tree for the specified document.
|
||||
* Before a modified document is committed, accessing its PSI may return elements
|
||||
* corresponding to original (unmodified) state of the document.
|
||||
* corresponding to original (unmodified) state of the document.<p/>
|
||||
*
|
||||
* For documents corresponding to PSI with events enabled (see {@link FileViewProvider#isEventSystemEnabled()}, this should be called
|
||||
* in UI thread in a write-safe context (see {@link com.intellij.openapi.application.TransactionGuard}). For non-physical files, this can be
|
||||
* called in any thread. In the latter case, clients hold themselves all responsibility for synchronizing that PSI.
|
||||
*
|
||||
* @param document the document to commit.
|
||||
*/
|
||||
|
||||
+6
-1
@@ -118,7 +118,7 @@ public class CodeStyleConfigurableWrapper
|
||||
@Override
|
||||
@NotNull
|
||||
public String getId() {
|
||||
return "preferences.sourceCode." + getDisplayName();
|
||||
return getConfigurableId(getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,4 +149,9 @@ public class CodeStyleConfigurableWrapper
|
||||
}
|
||||
return myPanel.processListOptions();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getConfigurableId(String configurableDisplayName) {
|
||||
return "preferences.sourceCode." + configurableDisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-7
@@ -26,7 +26,6 @@ package com.intellij.codeInsight.template.actions;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.OffsetKey;
|
||||
import com.intellij.codeInsight.completion.OffsetMap;
|
||||
import com.intellij.codeInsight.completion.OffsetsInFile;
|
||||
import com.intellij.codeInsight.template.TemplateContextType;
|
||||
import com.intellij.codeInsight.template.impl.*;
|
||||
@@ -49,10 +48,7 @@ import com.intellij.psi.util.PsiElementFilter;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class SaveAsTemplateAction extends AnAction {
|
||||
|
||||
@@ -61,8 +57,8 @@ public class SaveAsTemplateAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
Editor editor = Objects.requireNonNull(CommonDataKeys.EDITOR.getData(dataContext));
|
||||
PsiFile file = Objects.requireNonNull(CommonDataKeys.PSI_FILE.getData(dataContext));
|
||||
|
||||
final Project project = file.getProject();
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
|
||||
+14
-1
@@ -151,7 +151,20 @@ public class FileEncodingConfigurable extends PerFileConfigurableBase<Charset> {
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
myTablePanel.add(super.createComponent(), BorderLayout.CENTER);
|
||||
JPanel p = createActionPanel(null, () -> myPropsCharset, o -> myPropsCharset = o);
|
||||
JPanel p = createActionPanel(null, new Value<Charset>() {
|
||||
@Override
|
||||
public void commit() {}
|
||||
|
||||
@Override
|
||||
public Charset get() {
|
||||
return myPropsCharset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Charset value) {
|
||||
myPropsCharset = value;
|
||||
}
|
||||
});
|
||||
myPropertiesFilesEncodingCombo.add(p, BorderLayout.CENTER);
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
private final List<Trinity<String, Producer<T>, Consumer<T>>> myDefaultProps = ContainerUtil.newArrayList();
|
||||
private VirtualFile myFileToSelect;
|
||||
|
||||
protected interface Value<T> extends Setter<T>, Getter<T> {
|
||||
void commit();
|
||||
}
|
||||
|
||||
protected PerFileConfigurableBase(@NotNull Project project, @NotNull PerFileMappings<T> mappings) {
|
||||
myProject = project;
|
||||
myMappings = mappings;
|
||||
@@ -210,9 +214,20 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
|
||||
for (Trinity<String, Producer<T>, Consumer<T>> prop : myDefaultProps) {
|
||||
myDefaultVals.put(prop.first, prop.second.produce());
|
||||
JPanel p = createActionPanel(null,
|
||||
() -> myDefaultVals.get(prop.first),
|
||||
o -> myDefaultVals.put(prop.first, adjustChosenValue(null, o)));
|
||||
JPanel p = createActionPanel(null, new Value<T>() {
|
||||
@Override
|
||||
public void commit() {}
|
||||
|
||||
@Override
|
||||
public T get() {
|
||||
return myDefaultVals.get(prop.first);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(T value) {
|
||||
myDefaultVals.put(prop.first, adjustChosenValue(null, value));
|
||||
}
|
||||
});
|
||||
panel.add(new JBLabel(prop.first + ":"), cons1);
|
||||
panel.add(p, cons2);
|
||||
}
|
||||
@@ -477,20 +492,31 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
editorValue = pair.second; // (T)value
|
||||
if (!canEditTarget(target, editorValue)) return null;
|
||||
|
||||
JPanel panel = createActionPanel(target, () -> editorValue, chosen -> {
|
||||
editorValue = adjustChosenValue(target, chosen);
|
||||
TableUtil.stopEditing(myTable);
|
||||
selectRows(new int[]{modelRow}, true);
|
||||
if (Comparing.equal(editorValue, pair.second)) {
|
||||
// do nothing
|
||||
JPanel panel = createActionPanel(target, new Value<T>() {
|
||||
@Override
|
||||
public T get() {
|
||||
return editorValue;
|
||||
}
|
||||
else {
|
||||
int ret = clearSubdirectoriesOnDemandOrCancel(false, target);
|
||||
if (ret == Messages.CANCEL) {
|
||||
myModel.setValueAt(value, modelRow, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(T value) {
|
||||
editorValue = adjustChosenValue(target, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() {
|
||||
TableUtil.stopEditing(myTable);
|
||||
selectRows(new int[]{modelRow}, true);
|
||||
}
|
||||
if (Comparing.equal(editorValue, pair.second)) {
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
int ret = clearSubdirectoriesOnDemandOrCancel(false, target);
|
||||
if (ret == Messages.CANCEL) {
|
||||
myModel.setValueAt(value, modelRow, column);
|
||||
}
|
||||
selectRows(new int[]{modelRow}, true);
|
||||
} }
|
||||
}, true);
|
||||
|
||||
AbstractButton button = UIUtil.uiTraverser(panel).filter(JButton.class).first();
|
||||
@@ -516,13 +542,13 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected JPanel createActionPanel(@Nullable Object target, Producer<T> value, @NotNull Consumer<T> consumer) {
|
||||
return createActionPanel(target, value, consumer, false);
|
||||
protected JPanel createActionPanel(@Nullable Object target, @NotNull Value<T> value) {
|
||||
return createActionPanel(target, value, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JPanel createActionPanel(@Nullable Object target, Producer<T> value, @NotNull Consumer<T> consumer, boolean editor) {
|
||||
AnAction changeAction = createValueAction(target, value, consumer);
|
||||
private JPanel createActionPanel(@Nullable Object target, @NotNull Value<T> value, boolean editor) {
|
||||
AnAction changeAction = createValueAction(target, value);
|
||||
JComponent comboComponent = ((CustomComponentAction)changeAction).createCustomComponent(changeAction.getTemplatePresentation());
|
||||
JPanel panel = new JPanel(new BorderLayout()) {
|
||||
@Override
|
||||
@@ -620,10 +646,10 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected final AnAction createValueAction(@Nullable Object target, Producer<T> value, @NotNull Consumer<T> consumer) {
|
||||
protected final AnAction createValueAction(@Nullable Object target, @NotNull Value<T> value) {
|
||||
return new ComboBoxAction() {
|
||||
void updateText() {
|
||||
String text = renderValue(value.produce(), StringUtil.notNullize(getNullValueText(target)));
|
||||
String text = renderValue(value.get(), StringUtil.notNullize(getNullValueText(target)));
|
||||
getTemplatePresentation().setText(StringUtil.shortenTextWithEllipsis(text, 40, 0));
|
||||
}
|
||||
|
||||
@@ -642,10 +668,10 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
protected ComboBoxButton createComboBoxButton(Presentation presentation) {
|
||||
return new ComboBoxButton(presentation) {
|
||||
protected JBPopup createPopup(Runnable onDispose) {
|
||||
JBPopup popup = createValueEditorPopup(target, value.produce(), onDispose, getDataContext(), o -> {
|
||||
consumer.consume(o);
|
||||
JBPopup popup = createValueEditorPopup(target, value.get(), onDispose, getDataContext(), o -> {
|
||||
value.set(o);
|
||||
updateText();
|
||||
});
|
||||
}, value::commit);
|
||||
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
|
||||
return popup;
|
||||
}
|
||||
@@ -654,7 +680,7 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
@Override
|
||||
public String getToolTipText() {
|
||||
boolean cellEditor = UIUtil.uiParents(this, true).take(4).filter(JBTable.class).first() != null;
|
||||
return cellEditor ? null : getToolTipFor(value.produce());
|
||||
return cellEditor ? null : getToolTipFor(value.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -666,8 +692,12 @@ public abstract class PerFileConfigurableBase<T> implements SearchableConfigurab
|
||||
@Nullable T value,
|
||||
@Nullable Runnable onDispose,
|
||||
@NotNull DataContext dataContext,
|
||||
@NotNull Consumer<T> onChosen) {
|
||||
return createValueEditorActionListPopup(target, onDispose, dataContext, onChosen);
|
||||
@NotNull Consumer<T> onChosen,
|
||||
@NotNull Runnable onCommit) {
|
||||
return createValueEditorActionListPopup(target, onDispose, dataContext, chosen -> {
|
||||
onChosen.consume(chosen);
|
||||
onCommit.run();
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+5
-5
@@ -81,8 +81,7 @@ import java.util.Map;
|
||||
public class FileChooserDialogImpl extends DialogWrapper implements FileChooserDialog, PathChooserDialog, FileLookup {
|
||||
@NonNls public static final String FILE_CHOOSER_SHOW_PATH_PROPERTY = "FileChooser.ShowPath";
|
||||
public static final String RECENT_FILES_KEY = "file.chooser.recent.files";
|
||||
public static final String DRAG_N_DROP_HINT =
|
||||
"<html><center><small><font color=gray>Drag and drop a file into the space above to quickly locate it in the tree</font></small></center></html>";
|
||||
public static final String DRAG_N_DROP_HINT = "Drag and drop a file into the space above to quickly locate it in the tree";
|
||||
private final FileChooserDescriptor myChooserDescriptor;
|
||||
protected FileSystemTreeImpl myFileSystemTree;
|
||||
private Project myProject;
|
||||
@@ -342,9 +341,10 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
panel.add(scrollPane, BorderLayout.CENTER);
|
||||
panel.setPreferredSize(JBUI.size(400));
|
||||
|
||||
|
||||
panel.add(new JLabel(DRAG_N_DROP_HINT, SwingConstants.CENTER), BorderLayout.SOUTH);
|
||||
|
||||
JLabel dndLabel = new JLabel(DRAG_N_DROP_HINT, SwingConstants.CENTER);
|
||||
dndLabel.setFont(JBUI.Fonts.miniFont());
|
||||
dndLabel.setForeground(UIUtil.getLabelDisabledForeground());
|
||||
panel.add(dndLabel, BorderLayout.SOUTH);
|
||||
|
||||
ApplicationManager.getApplication().getMessageBus().connect(getDisposable())
|
||||
.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -107,7 +107,7 @@ public final class NettyUtil {
|
||||
.allowCredentials()
|
||||
.allowNullOrigin()
|
||||
.allowedRequestMethods(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE, HttpMethod.HEAD, HttpMethod.PATCH)
|
||||
.allowedRequestHeaders("origin", "accept", "authorization", "content-type")
|
||||
.allowedRequestHeaders("origin", "accept", "authorization", "content-type", "x-ijt")
|
||||
.build()));
|
||||
}
|
||||
|
||||
|
||||
@@ -542,8 +542,9 @@ group.names.j2me.issues=J2ME issues
|
||||
group.names.control.flow.issues=Control flow issues
|
||||
group.names.numeric.issues=Numeric issues
|
||||
group.names.language.level.specific.issues.and.migration.aids=Java language level migration aids
|
||||
group.names.language.level.specific.issues.and.migration.aids8=Java 8
|
||||
group.names.language.level.specific.issues.and.migration.aids7=Java 7
|
||||
group.names.language.level.specific.issues.and.migration.aids8=Java 8
|
||||
group.names.language.level.specific.issues.and.migration.aids9=Java 9
|
||||
group.names.javabeans.issues=JavaBeans issues
|
||||
group.names.inheritance.issues=Inheritance issues
|
||||
group.names.data.flow.issues=Data flow issues
|
||||
@@ -783,3 +784,8 @@ inspection.redundant.stream.optional.call.option.streamboxing=Report useless box
|
||||
inspection.map.foreach.message=Can be replaced with 'Map.forEach'
|
||||
inspection.map.foreach.fix.name=Replace with Map.forEach
|
||||
inspection.map.foreach.option.no.loops=Do not report loops
|
||||
|
||||
inspection.collection.factories.message=Can be replaced with ''{0}.of'' call
|
||||
inspection.collection.factories.option.ignore.non.constant=Do not warn when content is non-constant
|
||||
inspection.collection.factories.fix.family.name=Replace with collection factory call
|
||||
inspection.collection.factories.fix.name=Replace with ''{0}.of'' call
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<p>The <span class="control">Version Control</span> tool window shows all deleted, modified, and unversioned files in a
|
||||
single view. Use <span class="shortcut">&shortcut:ActivateChangesToolWindow;</span> keyboard shortcut to show or
|
||||
hide this tool window.</p>
|
||||
<p>From the <span class="control">Changes</span> tool window you can perform all the necessary version control
|
||||
<p>From the <span class="control">Version Control</span> tool window you can perform all the necessary version control
|
||||
actions: commit changes, manage changelists, put resources under version control, examine differences and more.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.util.ui.UIUtil;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.CharArrayReader;
|
||||
@@ -50,7 +51,7 @@ public class InspectionTestUtil {
|
||||
Element[] expectedArray = expectedProblems.toArray(new Element[expectedProblems.size()]);
|
||||
boolean failed = false;
|
||||
|
||||
expected:
|
||||
expected:
|
||||
for (Element expectedProblem : expectedArray) {
|
||||
Element[] reportedArrayed = reportedProblems.toArray(new Element[reportedProblems.size()]);
|
||||
for (Element reportedProblem : reportedArrayed) {
|
||||
@@ -62,13 +63,13 @@ expected:
|
||||
}
|
||||
|
||||
Document missing = new Document(expectedProblem.clone());
|
||||
System.out.println("The following haven't been reported as expected: " + new String(JDOMUtil.printDocument(missing, "\n")));
|
||||
System.out.println("The following haven't been reported as expected: " + JDOMUtil.writeDocument(missing, "\n"));
|
||||
failed = true;
|
||||
}
|
||||
|
||||
for (Element reportedProblem : reportedProblems) {
|
||||
Document extra = new Document(reportedProblem.clone());
|
||||
System.out.println("The following has been unexpectedly reported: " + new String(JDOMUtil.printDocument(extra, "\n")));
|
||||
System.out.println("The following has been unexpectedly reported: " + JDOMUtil.writeDocument(extra, "\n"));
|
||||
failed = true;
|
||||
}
|
||||
|
||||
@@ -136,23 +137,32 @@ expected:
|
||||
public static void compareToolResults(@NotNull GlobalInspectionContextImpl context,
|
||||
@NotNull InspectionToolWrapper toolWrapper,
|
||||
boolean checkRange,
|
||||
String testDir) {
|
||||
@NotNull String testDir) {
|
||||
compareToolResults(context, checkRange, testDir, Collections.singletonList(toolWrapper));
|
||||
}
|
||||
|
||||
static void compareToolResults(@NotNull GlobalInspectionContextImpl context,
|
||||
boolean checkRange,
|
||||
@NotNull String testDir,
|
||||
@NotNull Collection<? extends InspectionToolWrapper> toolWrappers) {
|
||||
final Element root = new Element("problems");
|
||||
final Document doc = new Document(root);
|
||||
InspectionToolPresentation presentation = context.getPresentation(toolWrapper);
|
||||
|
||||
presentation.updateContent(); //e.g. dead code need check for reachables
|
||||
presentation.exportResults(root, x -> false, x -> false);
|
||||
for (InspectionToolWrapper toolWrapper : toolWrappers) {
|
||||
InspectionToolPresentation presentation = context.getPresentation(toolWrapper);
|
||||
presentation.updateContent(); //e.g. dead code need check for reachables
|
||||
presentation.exportResults(root, x -> false, x -> false);
|
||||
}
|
||||
|
||||
File file = new File(testDir + "/expected.xml");
|
||||
try {
|
||||
compareWithExpected(JDOMUtil.loadDocument(file), doc, checkRange);
|
||||
File file = new File(testDir + "/expected.xml");
|
||||
compareWithExpected(JDOMUtil.loadDocument(file), new Document(root), checkRange);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void runTool(@NotNull InspectionToolWrapper toolWrapper,
|
||||
@NotNull final AnalysisScope scope,
|
||||
@NotNull final GlobalInspectionContextForTests globalContext) {
|
||||
|
||||
+5
@@ -63,6 +63,11 @@ public class JUnitAbstractTestClassNamingConventionInspectionBase extends Conven
|
||||
return new NamingConventionsVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldInspect(PsiFile file) {
|
||||
return file instanceof PsiClassOwner;
|
||||
}
|
||||
|
||||
private class NamingConventionsVisitor extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
|
||||
+5
-2
@@ -17,12 +17,10 @@ package com.siyeh.ig.junit;
|
||||
|
||||
import com.intellij.codeInsight.TestFrameworks;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.testIntegration.TestFramework;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.naming.ConventionInspection;
|
||||
import com.siyeh.ig.psiutils.TestUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JUnitTestClassNamingConventionInspectionBase extends ConventionInspection {
|
||||
@@ -66,6 +64,11 @@ public class JUnitTestClassNamingConventionInspectionBase extends ConventionInsp
|
||||
return new NamingConventionsVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldInspect(PsiFile file) {
|
||||
return file instanceof PsiClassOwner;
|
||||
}
|
||||
|
||||
private class NamingConventionsVisitor extends BaseInspectionVisitor {
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
|
||||
+29
@@ -26,6 +26,7 @@ import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.siyeh.HardcodedMethodConstants;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -34,6 +35,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ExpressionUtils {
|
||||
@NonNls static final Set<String> convertableBoxedClassNames = new HashSet<>(3);
|
||||
@@ -222,11 +224,38 @@ public class ExpressionUtils {
|
||||
return "\"\"".equals(text);
|
||||
}
|
||||
|
||||
@Contract("null -> false")
|
||||
public static boolean isNullLiteral(@Nullable PsiExpression expression) {
|
||||
expression = ParenthesesUtils.stripParentheses(expression);
|
||||
return expression != null && PsiType.NULL.equals(expression.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns stream of sub-expressions of supplied expression which could be equal (by ==) to resulting
|
||||
* value of the expression. The expressions in returned stream are guaranteed not to be each other ancestors.
|
||||
* Also the expression value is guaranteed to be equal to one of returned sub-expressions.
|
||||
*
|
||||
* <p>
|
||||
* E.g. for {@code ((a) ? b : (c))} the stream will contain b and c.
|
||||
* </p>
|
||||
*
|
||||
* @param expression expression to create a stream from
|
||||
* @return a new stream
|
||||
*/
|
||||
public static Stream<PsiExpression> possibleValues(@NotNull PsiExpression expression) {
|
||||
return StreamEx.ofTree(expression, e -> {
|
||||
if (e instanceof PsiConditionalExpression) {
|
||||
PsiConditionalExpression ternary = (PsiConditionalExpression)e;
|
||||
return StreamEx.of(ternary.getThenExpression(), ternary.getElseExpression()).nonNull();
|
||||
}
|
||||
if (e instanceof PsiParenthesizedExpression) {
|
||||
return StreamEx.ofNullable(((PsiParenthesizedExpression)e).getExpression());
|
||||
}
|
||||
return null;
|
||||
}).remove(e -> e instanceof PsiConditionalExpression ||
|
||||
e instanceof PsiParenthesizedExpression);
|
||||
}
|
||||
|
||||
public static boolean isZero(@Nullable PsiExpression expression) {
|
||||
if (expression == null) {
|
||||
return false;
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
<idea-plugin>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<localInspection shortName="UnknownLanguage" displayName="Unknown Language ID" groupName="Language Injection" enabledByDefault="true"
|
||||
<localInspection language="JAVA" shortName="UnknownLanguage" displayName="Unknown Language ID" groupName="Language Injection" enabledByDefault="true"
|
||||
level="ERROR" implementationClass="org.intellij.plugins.intelliLang.inject.java.validation.UnknownLanguageID"/>
|
||||
<localInspection shortName="LanguageMismatch" displayName="Language Mismatch" groupName="Language Injection" enabledByDefault="true"
|
||||
<localInspection language="JAVA" shortName="LanguageMismatch" displayName="Language Mismatch" groupName="Language Injection" enabledByDefault="true"
|
||||
level="WARNING" implementationClass="org.intellij.plugins.intelliLang.inject.java.validation.LanguageMismatch"/>
|
||||
<localInspection shortName="InjectionNotApplicable" displayName="Injection Annotation not applicable" groupName="Language Injection"
|
||||
<localInspection language="JAVA" shortName="InjectionNotApplicable" displayName="Injection Annotation not applicable" groupName="Language Injection"
|
||||
enabledByDefault="true" level="ERROR"
|
||||
implementationClass="org.intellij.plugins.intelliLang.inject.java.validation.InjectionNotApplicable"/>
|
||||
|
||||
<localInspection shortName="PatternValidation" displayName="Validate Annotated Patterns" groupName="Pattern Validation"
|
||||
<localInspection language="JAVA" shortName="PatternValidation" displayName="Validate Annotated Patterns" groupName="Pattern Validation"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
implementationClass="org.intellij.plugins.intelliLang.pattern.PatternValidator"/>
|
||||
<localInspection shortName="PatternNotApplicable" displayName="Pattern Annotation not applicable" groupName="Pattern Validation"
|
||||
<localInspection language="JAVA" shortName="PatternNotApplicable" displayName="Pattern Annotation not applicable" groupName="Pattern Validation"
|
||||
enabledByDefault="true" level="ERROR"
|
||||
implementationClass="org.intellij.plugins.intelliLang.pattern.PatternAnnotationNotApplicable"/>
|
||||
<localInspection language="JAVA" shortName="PatternOverriddenByNonAnnotatedMethod" displayName="Non-annotated Method overrides @Pattern Method"
|
||||
|
||||
+6
-1
@@ -40,6 +40,8 @@ import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.components.labels.LinkLabel;
|
||||
import com.intellij.ui.components.labels.LinkListener;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
@@ -143,7 +145,10 @@ public abstract class SelectLocationStep extends WizardStep {
|
||||
myNorthPanel.add(toolbarPanel, BorderLayout.NORTH);
|
||||
panel.add(myNorthPanel, BorderLayout.NORTH);
|
||||
panel.add(ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree()), BorderLayout.CENTER);
|
||||
panel.add(new JLabel(FileChooserDialogImpl.DRAG_N_DROP_HINT, SwingConstants.CENTER), BorderLayout.SOUTH);
|
||||
JLabel dndLabel = new JLabel(FileChooserDialogImpl.DRAG_N_DROP_HINT, SwingConstants.CENTER);
|
||||
dndLabel.setFont(JBUI.Fonts.miniFont());
|
||||
dndLabel.setForeground(UIUtil.getLabelDisabledForeground());
|
||||
panel.add(dndLabel, BorderLayout.SOUTH);
|
||||
myUiUpdater = new MergingUpdateQueue("FileChooserUpdater", 200, false, panel);
|
||||
Disposer.register(myFileSystemTree, myUiUpdater);
|
||||
new UiNotifyConnector(panel, myUiUpdater);
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
<orderEntry type="module" module-name="properties-psi-impl" />
|
||||
<orderEntry type="module" module-name="ui-designer" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -3,11 +3,14 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.i18n;
|
||||
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
import com.intellij.testFramework.InspectionsKt;
|
||||
import com.intellij.uiDesigner.i18n.I18nFormInspection;
|
||||
|
||||
/**
|
||||
* @author lesya
|
||||
@@ -40,7 +43,12 @@ public class I18NInspectionTest extends InspectionTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testFormTabbedPaneTitle() throws Exception { doTest(); }
|
||||
public void testFormTabbedPaneTitle() throws Exception {
|
||||
LocalInspectionToolWrapper wrapper = new LocalInspectionToolWrapper(new I18nFormInspection());
|
||||
InspectionsKt.enableInspectionTool(getProject(), wrapper, getTestRootDisposable());
|
||||
doTest("i18n/" + getTestName(true), new LocalInspectionToolWrapper(new I18nInspection()), "java 1.4", false, false,
|
||||
wrapper);
|
||||
}
|
||||
public void testVarargNonNlsParameter() throws Exception { doTest(); }
|
||||
public void testInitializerInAnonymousClass() throws Exception{ doTest(); }
|
||||
public void testNonNlsArray() throws Exception{ doTest(); }
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
|
||||
<fileTypeFactory implementation="com.intellij.uiDesigner.FormFileTypeFactory"/>
|
||||
|
||||
<invalidPropertyKeyInspectionTool implementation="com.intellij.uiDesigner.i18n.InvalidPropertyKeyFormInspection"/>
|
||||
<i18nInspectionTool implementation="com.intellij.uiDesigner.i18n.I18nFormInspection"/>
|
||||
<java15InspectionTool implementation="com.intellij.uiDesigner.inspections.Java15FormInspection"/>
|
||||
|
||||
<search.topHitProvider implementation="com.intellij.uiDesigner.GuiDesignerOptionsTopHitProvider"/>
|
||||
<projectConfigurable groupId="editor" instance="com.intellij.uiDesigner.GuiDesignerConfigurable" id="project.propGUI" key="title.gui.designer"
|
||||
bundle="messages.UIDesignerBundle"/>
|
||||
@@ -46,22 +42,22 @@
|
||||
<runConfigurationExtension implementation="com.intellij.uiDesigner.snapShooter.SnapShooterConfigurationExtension"/>
|
||||
<usageTypeProvider implementation="com.intellij.uiDesigner.binding.FormUsageTypeProvider"/>
|
||||
|
||||
<localInspection shortName="DuplicateMnemonic" bundle="messages.UIDesignerBundle" key="inspection.duplicate.mnemonics"
|
||||
<localInspection language="TEXT" shortName="DuplicateMnemonic" bundle="messages.UIDesignerBundle" key="inspection.duplicate.mnemonics"
|
||||
groupKey="form.inspections.group" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.uiDesigner.inspections.DuplicateMnemonicInspection"/>
|
||||
<localInspection shortName="MissingMnemonic" bundle="messages.UIDesignerBundle" key="inspection.missing.mnemonics"
|
||||
<localInspection language="TEXT" shortName="MissingMnemonic" bundle="messages.UIDesignerBundle" key="inspection.missing.mnemonics"
|
||||
groupKey="form.inspections.group" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.uiDesigner.inspections.MissingMnemonicInspection"/>
|
||||
<localInspection shortName="NoLabelFor" bundle="messages.UIDesignerBundle" key="inspection.no.label.for"
|
||||
<localInspection language="TEXT" shortName="NoLabelFor" bundle="messages.UIDesignerBundle" key="inspection.no.label.for"
|
||||
groupKey="form.inspections.group" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.uiDesigner.inspections.NoLabelForInspection"/>
|
||||
<localInspection shortName="NoButtonGroup" bundle="messages.UIDesignerBundle" key="inspection.no.button.group"
|
||||
<localInspection language="TEXT" shortName="NoButtonGroup" bundle="messages.UIDesignerBundle" key="inspection.no.button.group"
|
||||
groupKey="form.inspections.group" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.uiDesigner.inspections.NoButtonGroupInspection"/>
|
||||
<localInspection shortName="OneButtonGroup" bundle="messages.UIDesignerBundle" key="inspection.one.button.group"
|
||||
<localInspection language="TEXT" shortName="OneButtonGroup" bundle="messages.UIDesignerBundle" key="inspection.one.button.group"
|
||||
groupKey="form.inspections.group" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.uiDesigner.inspections.OneButtonGroupInspection"/>
|
||||
<localInspection shortName="NoScrollPane" bundle="messages.UIDesignerBundle" key="inspection.no.scroll.pane"
|
||||
<localInspection language="TEXT" shortName="NoScrollPane" bundle="messages.UIDesignerBundle" key="inspection.no.scroll.pane"
|
||||
groupKey="form.inspections.group" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.uiDesigner.inspections.NoScrollPaneInspection"/>
|
||||
<localInspection shortName="BoundFieldAssignment" bundle="messages.UIDesignerBundle" key="inspection.bound.field.title"
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class BaseFormInspection extends BaseJavaLocalInspectionTool implements FileCheckingInspection, FormInspectionTool {
|
||||
public abstract class BaseFormInspection extends BaseJavaLocalInspectionTool implements FormInspectionTool {
|
||||
private final String myInspectionKey;
|
||||
|
||||
public BaseFormInspection(@NonNls @NotNull String inspectionKey) {
|
||||
|
||||
+5
-10
@@ -9,21 +9,15 @@ import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.XmlElementVisitor;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import org.intellij.lang.xpath.xslt.XsltSupport;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltApplyTemplates;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltCallTemplate;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltElementFactory;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltParameter;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltTemplate;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltTemplateInvocation;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltWithParam;
|
||||
import org.intellij.lang.xpath.xslt.psi.*;
|
||||
import org.intellij.lang.xpath.xslt.quickfix.AbstractFix;
|
||||
import org.intellij.lang.xpath.xslt.quickfix.AddParameterFix;
|
||||
import org.intellij.lang.xpath.xslt.quickfix.AddWithParamFix;
|
||||
import org.intellij.lang.xpath.xslt.quickfix.RemoveParamFix;
|
||||
import org.intellij.lang.xpath.xslt.quickfix.AbstractFix;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -52,6 +46,7 @@ public class TemplateInvocationInspection extends XsltInspection {
|
||||
|
||||
@NotNull
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
|
||||
if (!(holder.getFile() instanceof XmlFile)) return PsiElementVisitor.EMPTY_VISITOR;
|
||||
final XsltElementFactory xsltElementFactory = XsltElementFactory.getInstance();
|
||||
return new XmlElementVisitor() {
|
||||
@Override
|
||||
|
||||
+2
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.XmlElementVisitor;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import org.intellij.lang.xpath.xslt.XsltSupport;
|
||||
import org.intellij.lang.xpath.xslt.psi.XsltElementFactory;
|
||||
@@ -45,6 +46,7 @@ public class UnusedElementInspection extends XsltInspection {
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
|
||||
if (!(holder.getFile() instanceof XmlFile)) return PsiElementVisitor.EMPTY_VISITOR;
|
||||
return new MyVisitor(holder);
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class VariableShadowingInspection extends XsltInspection {
|
||||
|
||||
@NotNull
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
|
||||
if (!(holder.getFile() instanceof XmlFile)) return PsiElementVisitor.EMPTY_VISITOR;
|
||||
return new XmlElementVisitor() {
|
||||
@Override
|
||||
public void visitXmlTag(final XmlTag tag) {
|
||||
|
||||
+1
@@ -47,6 +47,7 @@ public class XsltDeclarationInspection extends XsltInspection {
|
||||
|
||||
@NotNull
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
|
||||
if (!(holder.getFile() instanceof XmlFile)) return PsiElementVisitor.EMPTY_VISITOR;
|
||||
return new XmlElementVisitor() {
|
||||
@Override
|
||||
public void visitXmlTag(final XmlTag tag) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
* l is of the form l = 2*k, k a non negative integer
|
||||
*/
|
||||
private static final int ZZ_LEXSTATE[] = {
|
||||
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5
|
||||
0, 0, 1, 1, 2, 2, 0, 0, 3, 3, 4, 4
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -75,9 +75,9 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
private static final int [] ZZ_ACTION = zzUnpackAction();
|
||||
|
||||
private static final String ZZ_ACTION_PACKED_0 =
|
||||
"\16\0\1\1\1\2\1\3\1\4\1\5\1\2\1\6"+
|
||||
"\15\0\1\1\1\2\1\3\1\4\1\5\1\2\1\6"+
|
||||
"\1\7\1\10\2\2\1\11\1\12\4\2\1\13\1\2"+
|
||||
"\1\1\1\4\2\2\1\11\1\2\1\1\1\4\5\2"+
|
||||
"\1\1\1\4\2\2\1\11\1\2\1\1\1\4\4\2"+
|
||||
"\1\1\1\4\2\2\1\14\1\15\1\16\10\0\1\1"+
|
||||
"\1\0\1\17\1\0\2\20\2\21\2\22\6\0\1\23"+
|
||||
"\2\0\1\24\1\0\2\25\4\0\2\26\1\0\1\1"+
|
||||
@@ -88,7 +88,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
"\3\0\2\1\1\0\4\1\1\0\1\1\2\0\1\1";
|
||||
|
||||
private static int [] zzUnpackAction() {
|
||||
int [] result = new int[170];
|
||||
int [] result = new int[168];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -114,30 +114,29 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
|
||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
||||
"\0\0\0\34\0\70\0\124\0\160\0\214\0\250\0\304"+
|
||||
"\0\340\0\374\0\u0118\0\u0134\0\u0150\0\u016c\0\u0188\0\u01a4"+
|
||||
"\0\u01a4\0\u01c0\0\u01dc\0\u01f8\0\u01a4\0\u0214\0\u01a4\0\u0230"+
|
||||
"\0\u024c\0\u0268\0\u01a4\0\u0284\0\u02a0\0\u02bc\0\u02d8\0\u01a4"+
|
||||
"\0\340\0\374\0\u0118\0\u0134\0\u0150\0\u016c\0\u0188\0\u0188"+
|
||||
"\0\u01a4\0\u01c0\0\u01dc\0\u0188\0\u01f8\0\u0188\0\u0214\0\u0230"+
|
||||
"\0\u024c\0\u0188\0\u0268\0\u0284\0\u02a0\0\u02bc\0\u0188\0\u02d8"+
|
||||
"\0\u02f4\0\u0310\0\u032c\0\u0348\0\u0364\0\u0380\0\u039c\0\u03b8"+
|
||||
"\0\u03d4\0\u03f0\0\u03d4\0\u040c\0\u0428\0\u01c0\0\u0444\0\u0460"+
|
||||
"\0\u047c\0\u0460\0\u0498\0\u01a4\0\u04b4\0\u04d0\0\u01a4\0\u04ec"+
|
||||
"\0\u0508\0\u0524\0\u0540\0\u055c\0\u0578\0\u0594\0\u05b0\0\u05cc"+
|
||||
"\0\u0188\0\u01a4\0\u05e8\0\u01a4\0\u0604\0\u01a4\0\u0620\0\u063c"+
|
||||
"\0\u0658\0\u0674\0\u02a0\0\u040c\0\u0690\0\u06ac\0\u02bc\0\u0428"+
|
||||
"\0\u06c8\0\u06e4\0\u01a4\0\u0700\0\u071c\0\u0738\0\u0754\0\u0770"+
|
||||
"\0\u01a4\0\u078c\0\u07a8\0\u07c4\0\u07e0\0\u07fc\0\u0310\0\u0818"+
|
||||
"\0\u0834\0\u0850\0\u086c\0\u03d4\0\u03b8\0\u0888\0\u01a4\0\u08a4"+
|
||||
"\0\u08c0\0\u08dc\0\u0460\0\u0444\0\u01a4\0\u08f8\0\u0914\0\u0930"+
|
||||
"\0\u08f8\0\u094c\0\u0968\0\u0984\0\u0524\0\u09a0\0\u09bc\0\u055c"+
|
||||
"\0\u01a4\0\u01a4\0\u09d8\0\u09f4\0\u0a10\0\u0a2c\0\u01a4\0\u0a48"+
|
||||
"\0\u0a64\0\u0a80\0\u01a4\0\u0a9c\0\u0ab8\0\u0ad4\0\u0af0\0\u0b0c"+
|
||||
"\0\u0b28\0\u0b44\0\u0b60\0\u0b7c\0\u0b98\0\u0bb4\0\u0bd0\0\u0bec"+
|
||||
"\0\u09f4\0\u0c08\0\u0c24\0\u0c40\0\u0c5c\0\u0c78\0\u0c94\0\u0cb0"+
|
||||
"\0\u0ccc\0\u0ce8\0\u0d04\0\u0ab8\0\u0d20\0\u0d3c\0\u0d58\0\u0d74"+
|
||||
"\0\u0b60\0\u0d90\0\u0dac\0\u0dc8\0\u0de4\0\u0e00\0\u0e1c\0\u0c78"+
|
||||
"\0\u0e38\0\u0e54";
|
||||
"\0\u03d4\0\u03b8\0\u03f0\0\u040c\0\u0428\0\u0444\0\u0460\0\u0444"+
|
||||
"\0\u047c\0\u0188\0\u0498\0\u04b4\0\u0188\0\u04d0\0\u04ec\0\u0508"+
|
||||
"\0\u0524\0\u0540\0\u055c\0\u0578\0\u0594\0\u05b0\0\u016c\0\u0188"+
|
||||
"\0\u05cc\0\u0188\0\u05e8\0\u0188\0\u0604\0\u0620\0\u063c\0\u0658"+
|
||||
"\0\u0284\0\u03f0\0\u0674\0\u0690\0\u02a0\0\u040c\0\u06ac\0\u06c8"+
|
||||
"\0\u0188\0\u06e4\0\u0700\0\u071c\0\u0738\0\u0754\0\u0188\0\u0770"+
|
||||
"\0\u078c\0\u07a8\0\u07c4\0\u07e0\0\u02f4\0\u07fc\0\u0818\0\u0834"+
|
||||
"\0\u0850\0\u03b8\0\u039c\0\u086c\0\u0188\0\u0888\0\u08a4\0\u08c0"+
|
||||
"\0\u0444\0\u0428\0\u0188\0\u08dc\0\u08f8\0\u0914\0\u08dc\0\u0930"+
|
||||
"\0\u094c\0\u0968\0\u0508\0\u0984\0\u09a0\0\u0540\0\u0188\0\u0188"+
|
||||
"\0\u09bc\0\u09d8\0\u09f4\0\u0a10\0\u0188\0\u0a2c\0\u0a48\0\u0a64"+
|
||||
"\0\u0188\0\u0a80\0\u0a9c\0\u0ab8\0\u0ad4\0\u0af0\0\u0b0c\0\u0b28"+
|
||||
"\0\u0b44\0\u0b60\0\u0b7c\0\u0b98\0\u0bb4\0\u0bd0\0\u09d8\0\u0bec"+
|
||||
"\0\u0c08\0\u0c24\0\u0c40\0\u0c5c\0\u0c78\0\u0c94\0\u0cb0\0\u0ccc"+
|
||||
"\0\u0ce8\0\u0a9c\0\u0d04\0\u0d20\0\u0d3c\0\u0d58\0\u0b44\0\u0d74"+
|
||||
"\0\u0d90\0\u0dac\0\u0dc8\0\u0de4\0\u0e00\0\u0c5c\0\u0e1c\0\u0e38";
|
||||
|
||||
private static int [] zzUnpackRowMap() {
|
||||
int [] result = new int[170];
|
||||
int [] result = new int[168];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -160,183 +159,179 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\1\17\2\20\1\21\1\22\1\23\1\24\1\25\1\26"+
|
||||
"\1\27\1\30\1\26\1\31\1\32\1\33\1\34\1\17"+
|
||||
"\1\35\1\36\3\17\1\20\1\37\1\17\1\40\1\17"+
|
||||
"\1\41\1\42\2\20\1\21\1\43\1\23\1\44\1\25"+
|
||||
"\1\26\1\27\1\45\1\26\1\20\1\46\1\33\1\47"+
|
||||
"\1\42\1\35\1\36\3\42\1\20\1\37\1\42\1\40"+
|
||||
"\1\42\1\20\1\50\2\20\1\21\1\51\1\23\1\52"+
|
||||
"\1\25\1\26\1\27\1\53\1\26\1\31\1\32\1\33"+
|
||||
"\1\34\1\50\1\54\1\55\3\50\1\20\1\37\1\50"+
|
||||
"\1\40\1\50\1\41\1\17\2\20\1\21\1\22\1\23"+
|
||||
"\1\24\1\25\1\26\1\27\1\56\1\26\1\31\1\32"+
|
||||
"\1\33\1\34\1\17\1\35\1\36\3\17\1\20\1\37"+
|
||||
"\1\17\1\40\1\17\1\41\1\57\2\20\1\21\1\60"+
|
||||
"\1\23\1\61\1\25\1\26\1\27\1\62\1\26\1\31"+
|
||||
"\1\46\1\33\1\47\1\57\1\54\1\55\3\57\1\20"+
|
||||
"\1\37\1\57\1\40\1\57\1\41\7\63\1\64\1\65"+
|
||||
"\2\63\1\65\20\63\27\0\1\66\13\0\1\67\1\70"+
|
||||
"\2\0\1\70\20\0\1\71\3\0\1\72\1\0\1\72"+
|
||||
"\3\0\1\72\5\0\1\71\2\0\3\71\2\0\1\71"+
|
||||
"\1\0\1\71\2\0\1\67\1\0\1\67\3\0\3\67"+
|
||||
"\1\0\1\67\1\0\2\67\12\0\1\67\2\0\1\73"+
|
||||
"\3\0\1\74\1\0\1\74\3\0\1\74\5\0\1\73"+
|
||||
"\2\0\3\73\2\0\1\73\1\0\1\73\2\0\1\67"+
|
||||
"\5\0\2\67\2\0\1\67\34\0\1\75\52\0\1\75"+
|
||||
"\1\76\1\0\3\76\1\77\1\100\1\0\1\101\2\76"+
|
||||
"\1\101\20\76\34\0\1\17\1\0\5\17\2\0\2\17"+
|
||||
"\1\0\20\17\7\23\1\0\24\23\1\17\1\0\5\17"+
|
||||
"\1\102\1\103\2\17\1\103\20\17\10\0\1\26\2\0"+
|
||||
"\1\26\20\0\1\17\1\0\5\17\1\104\1\105\2\17"+
|
||||
"\1\105\20\17\7\0\1\106\1\107\1\0\1\110\1\107"+
|
||||
"\16\0\1\110\16\0\1\111\33\0\1\112\16\0\7\113"+
|
||||
"\1\114\10\113\1\115\1\116\12\113\7\117\1\120\12\117"+
|
||||
"\1\121\11\117\4\0\3\122\1\123\1\124\1\0\1\125"+
|
||||
"\1\124\3\0\1\126\2\0\1\122\2\125\2\122\1\127"+
|
||||
"\1\130\1\0\1\122\10\0\1\131\1\132\1\0\1\133"+
|
||||
"\1\132\16\0\1\133\1\0\1\134\1\0\1\134\1\135"+
|
||||
"\1\134\1\135\1\136\1\0\1\137\1\135\1\134\1\137"+
|
||||
"\1\134\2\135\12\134\1\135\2\134\1\42\1\0\1\42"+
|
||||
"\1\0\3\42\3\0\1\42\1\0\1\42\2\0\12\42"+
|
||||
"\1\0\3\42\1\0\1\42\1\0\3\42\1\102\1\103"+
|
||||
"\1\0\1\42\1\103\1\42\2\0\12\42\1\0\3\42"+
|
||||
"\1\0\1\42\1\0\3\42\1\104\1\105\1\0\1\42"+
|
||||
"\1\105\1\42\2\0\12\42\1\0\2\42\15\0\1\140"+
|
||||
"\33\0\1\141\16\0\1\142\1\0\3\142\1\143\1\144"+
|
||||
"\1\0\1\145\2\142\1\145\20\142\1\50\1\0\5\50"+
|
||||
"\2\0\2\50\1\0\21\50\1\0\5\50\1\102\1\103"+
|
||||
"\2\50\1\103\20\50\20\114\1\146\1\147\12\114\22\120"+
|
||||
"\1\150\11\120\1\151\1\0\1\151\1\152\1\151\1\152"+
|
||||
"\1\153\1\0\1\154\1\152\1\151\1\154\1\151\2\152"+
|
||||
"\12\151\1\152\2\151\1\57\1\0\1\57\1\0\3\57"+
|
||||
"\3\0\1\57\1\0\1\57\2\0\12\57\1\0\3\57"+
|
||||
"\1\0\1\57\1\0\3\57\1\102\1\103\1\0\1\57"+
|
||||
"\1\103\1\57\2\0\12\57\1\0\2\57\7\63\1\0"+
|
||||
"\24\63\7\0\1\155\1\65\2\0\1\65\24\0\3\156"+
|
||||
"\3\0\1\157\4\0\1\160\2\0\1\156\2\157\2\156"+
|
||||
"\1\161\1\162\1\0\1\156\11\0\1\70\2\0\1\70"+
|
||||
"\20\0\1\163\1\0\1\163\1\164\1\163\1\164\1\165"+
|
||||
"\1\0\1\71\1\164\1\163\1\71\1\163\2\164\12\163"+
|
||||
"\1\164\2\163\1\71\1\0\1\71\1\0\3\71\3\0"+
|
||||
"\1\71\1\0\1\71\2\0\12\71\1\0\2\71\1\166"+
|
||||
"\1\0\3\166\1\167\1\170\1\0\1\73\2\166\1\73"+
|
||||
"\20\166\1\73\1\0\5\73\2\0\2\73\1\0\20\73"+
|
||||
"\12\0\1\171\17\0\1\171\1\0\1\76\1\0\4\76"+
|
||||
"\1\100\1\0\1\101\2\76\1\101\20\76\5\0\1\17"+
|
||||
"\26\0\1\17\1\172\5\17\2\172\2\17\1\172\20\17"+
|
||||
"\10\0\1\103\2\0\1\103\30\0\1\105\2\0\1\105"+
|
||||
"\30\0\1\107\2\0\1\107\27\0\1\106\1\107\2\0"+
|
||||
"\1\107\20\0\5\173\1\0\1\173\1\0\1\173\3\0"+
|
||||
"\1\173\2\0\12\173\1\0\2\173\1\174\3\112\1\175"+
|
||||
"\1\112\1\175\1\0\2\112\1\175\3\112\1\176\1\112"+
|
||||
"\1\174\2\112\3\174\2\112\1\174\1\112\1\174\1\112"+
|
||||
"\7\113\1\114\24\113\6\0\1\177\33\0\1\177\13\0"+
|
||||
"\1\117\15\0\3\122\1\123\1\124\1\0\1\122\1\124"+
|
||||
"\3\0\1\126\2\0\5\122\3\0\1\122\11\0\1\124"+
|
||||
"\2\0\1\124\24\0\3\122\1\123\1\124\1\0\1\125"+
|
||||
"\1\124\3\0\1\126\2\0\1\122\2\125\2\122\1\127"+
|
||||
"\2\0\1\122\24\0\1\200\14\0\3\122\3\0\1\122"+
|
||||
"\4\0\1\126\2\0\5\122\3\0\1\122\4\0\4\201"+
|
||||
"\2\0\2\201\4\0\1\202\2\0\6\201\1\0\2\201"+
|
||||
"\11\0\1\132\2\0\1\132\27\0\1\131\1\132\2\0"+
|
||||
"\1\132\20\0\1\134\1\0\1\134\1\135\2\134\1\136"+
|
||||
"\1\0\1\137\1\135\1\134\1\137\1\134\2\135\12\134"+
|
||||
"\1\135\2\134\5\0\1\42\26\0\1\42\1\203\1\42"+
|
||||
"\1\203\3\42\3\203\1\42\1\203\1\42\2\203\12\42"+
|
||||
"\1\203\2\42\5\204\1\0\1\204\1\0\1\204\3\0"+
|
||||
"\1\204\2\0\12\204\1\0\2\204\1\205\3\141\1\206"+
|
||||
"\1\141\1\206\1\0\2\141\1\206\3\141\1\207\1\141"+
|
||||
"\1\205\2\141\3\205\2\141\1\205\1\141\1\205\1\141"+
|
||||
"\1\142\1\0\4\142\1\144\1\0\1\145\2\142\1\145"+
|
||||
"\20\142\5\0\1\50\26\0\34\114\22\0\1\120\11\0"+
|
||||
"\1\151\1\0\1\151\1\152\2\151\1\153\1\0\1\154"+
|
||||
"\1\152\1\151\1\154\1\151\2\152\12\151\1\152\2\151"+
|
||||
"\5\0\1\57\32\0\3\156\3\0\1\156\4\0\1\160"+
|
||||
"\2\0\5\156\3\0\1\156\5\0\3\156\3\0\1\157"+
|
||||
"\4\0\1\160\2\0\1\156\2\157\2\156\1\161\2\0"+
|
||||
"\1\156\24\0\1\210\13\0\4\211\2\0\2\211\4\0"+
|
||||
"\1\212\2\0\6\211\1\0\2\211\1\0\1\163\1\0"+
|
||||
"\1\163\1\164\2\163\1\165\1\0\1\71\1\164\1\163"+
|
||||
"\1\71\1\163\2\164\12\163\1\164\2\163\5\0\1\71"+
|
||||
"\26\0\1\166\1\0\4\166\1\170\1\0\1\73\2\166"+
|
||||
"\1\73\20\166\5\0\1\73\26\0\1\213\3\173\1\214"+
|
||||
"\1\0\1\144\1\0\1\173\1\0\1\214\1\173\2\0"+
|
||||
"\1\215\1\173\1\213\2\173\3\213\2\173\1\213\1\0"+
|
||||
"\1\213\1\173\1\216\1\112\2\216\1\217\1\220\1\175"+
|
||||
"\1\0\1\221\1\216\1\217\1\221\2\216\1\222\15\216"+
|
||||
"\1\174\1\112\2\174\1\217\1\174\1\217\1\0\1\112"+
|
||||
"\1\174\1\217\1\112\2\174\1\223\15\174\1\50\3\0"+
|
||||
"\1\144\1\0\1\144\3\0\1\144\5\0\1\50\2\0"+
|
||||
"\3\50\2\0\1\50\1\0\1\50\24\0\1\122\13\0"+
|
||||
"\4\201\2\0\2\201\1\0\1\224\2\0\1\202\2\0"+
|
||||
"\6\201\1\0\2\201\24\0\1\225\10\0\1\226\3\204"+
|
||||
"\1\227\1\0\1\153\1\0\1\204\1\0\1\227\1\204"+
|
||||
"\2\0\1\230\1\204\1\226\2\204\3\226\2\204\1\226"+
|
||||
"\1\0\1\226\1\204\1\231\1\141\1\231\1\232\1\233"+
|
||||
"\1\232\1\206\1\0\1\234\1\232\1\233\1\234\1\231"+
|
||||
"\1\232\1\235\12\231\1\232\2\231\1\205\1\141\1\205"+
|
||||
"\1\141\1\233\1\205\1\233\1\0\2\141\1\233\1\141"+
|
||||
"\1\205\1\141\1\207\12\205\1\141\2\205\1\57\3\0"+
|
||||
"\1\153\1\0\1\153\3\0\1\153\5\0\1\57\2\0"+
|
||||
"\3\57\2\0\1\57\1\0\1\57\24\0\1\156\13\0"+
|
||||
"\4\211\2\0\2\211\1\0\1\171\2\0\1\212\2\0"+
|
||||
"\6\211\1\0\2\211\24\0\1\236\10\0\1\237\1\173"+
|
||||
"\2\237\1\240\1\143\1\144\1\0\1\241\1\142\1\240"+
|
||||
"\1\241\2\142\1\242\12\237\1\142\2\237\1\213\1\173"+
|
||||
"\2\213\1\240\1\50\1\243\1\0\1\173\1\50\1\240"+
|
||||
"\1\173\2\50\1\244\12\213\1\50\2\213\1\50\3\0"+
|
||||
"\1\144\1\0\1\144\3\0\1\144\3\0\1\176\1\0"+
|
||||
"\1\50\2\0\3\50\2\0\1\50\1\0\1\50\1\0"+
|
||||
"\1\216\1\112\2\216\1\217\1\216\1\175\1\0\1\221"+
|
||||
"\1\216\1\217\1\221\2\216\1\222\16\216\1\112\2\216"+
|
||||
"\1\217\1\216\1\217\1\0\1\221\1\216\1\217\1\221"+
|
||||
"\2\216\1\222\15\216\1\174\3\112\1\175\1\174\1\175"+
|
||||
"\1\0\2\112\1\175\3\112\1\176\1\112\1\174\2\112"+
|
||||
"\3\174\2\112\1\174\1\112\1\174\1\112\1\142\1\0"+
|
||||
"\2\142\1\243\1\142\1\144\1\0\1\145\1\142\1\243"+
|
||||
"\1\145\21\142\1\0\2\142\1\243\1\143\1\144\1\0"+
|
||||
"\1\145\1\142\1\243\1\145\20\142\7\0\1\123\1\124"+
|
||||
"\2\0\1\124\43\0\1\201\10\0\1\245\1\204\1\245"+
|
||||
"\1\246\1\247\1\152\1\153\1\0\1\250\1\152\1\247"+
|
||||
"\1\250\1\151\1\152\1\251\12\245\1\152\2\245\1\226"+
|
||||
"\1\204\1\226\1\204\1\247\1\57\1\252\1\0\1\204"+
|
||||
"\1\0\1\247\1\204\1\57\1\0\1\230\12\226\1\0"+
|
||||
"\2\226\1\57\3\0\1\153\1\0\1\153\3\0\1\153"+
|
||||
"\3\0\1\207\1\0\1\57\2\0\3\57\2\0\1\57"+
|
||||
"\1\0\1\57\1\0\1\231\1\141\1\231\1\232\1\233"+
|
||||
"\1\231\1\206\1\0\1\234\1\232\1\233\1\234\1\231"+
|
||||
"\1\232\1\235\12\231\1\232\2\231\1\205\3\141\1\206"+
|
||||
"\1\205\1\206\1\0\2\141\1\206\3\141\1\207\1\141"+
|
||||
"\1\205\2\141\3\205\2\141\1\205\1\141\1\205\1\141"+
|
||||
"\1\231\1\141\1\231\1\232\1\233\1\231\1\233\1\0"+
|
||||
"\1\234\1\232\1\233\1\234\1\231\1\232\1\235\12\231"+
|
||||
"\1\232\2\231\1\57\3\0\1\153\1\57\1\153\3\0"+
|
||||
"\1\153\5\0\1\57\2\0\3\57\2\0\1\57\1\0"+
|
||||
"\1\57\24\0\1\211\10\0\1\237\1\173\2\237\1\240"+
|
||||
"\1\142\1\144\1\0\1\241\1\142\1\240\1\241\2\142"+
|
||||
"\1\242\12\237\1\142\3\237\1\173\2\237\1\240\1\142"+
|
||||
"\1\243\1\0\1\241\1\142\1\240\1\241\2\142\1\242"+
|
||||
"\12\237\1\142\2\237\1\142\1\0\2\142\1\243\1\142"+
|
||||
"\1\144\1\0\1\145\1\142\1\243\1\145\2\142\1\222"+
|
||||
"\16\142\1\0\4\142\1\243\1\0\1\145\2\142\1\145"+
|
||||
"\21\142\1\0\2\142\1\243\1\143\1\144\1\0\1\145"+
|
||||
"\1\142\1\243\1\145\2\142\1\222\15\142\1\245\1\204"+
|
||||
"\1\245\1\246\1\247\1\151\1\153\1\0\1\250\1\152"+
|
||||
"\1\247\1\250\1\151\1\152\1\251\12\245\1\152\2\245"+
|
||||
"\1\226\3\204\1\227\1\57\1\153\1\0\1\204\1\0"+
|
||||
"\1\227\1\204\2\0\1\230\1\204\1\226\2\204\3\226"+
|
||||
"\2\204\1\226\1\0\1\226\1\204\1\245\1\204\1\245"+
|
||||
"\1\246\1\247\1\151\1\252\1\0\1\250\1\152\1\247"+
|
||||
"\1\250\1\151\1\152\1\251\12\245\1\152\2\245\1\57"+
|
||||
"\3\0\1\153\1\57\1\153\3\0\1\153\3\0\1\207"+
|
||||
"\1\0\1\57\2\0\3\57\2\0\1\57\1\0\1\57"+
|
||||
"\1\0\1\151\1\0\1\151\1\152\2\151\1\252\1\0"+
|
||||
"\1\154\1\152\1\151\1\154\1\151\2\152\12\151\1\152"+
|
||||
"\2\151";
|
||||
"\1\16\2\17\1\20\1\21\1\22\1\23\1\24\1\25"+
|
||||
"\1\26\1\27\1\25\1\30\1\31\1\32\1\33\1\16"+
|
||||
"\1\34\1\35\3\16\1\17\1\36\1\16\1\37\1\16"+
|
||||
"\1\40\1\41\2\17\1\20\1\42\1\22\1\43\1\24"+
|
||||
"\1\25\1\26\1\44\1\25\1\17\1\45\1\32\1\46"+
|
||||
"\1\41\1\34\1\35\3\41\1\17\1\36\1\41\1\37"+
|
||||
"\1\41\1\17\1\47\2\17\1\20\1\50\1\22\1\51"+
|
||||
"\1\24\1\25\1\26\1\52\1\25\1\30\1\31\1\32"+
|
||||
"\1\33\1\47\1\53\1\54\3\47\1\17\1\36\1\47"+
|
||||
"\1\37\1\47\1\40\1\55\2\17\1\20\1\56\1\22"+
|
||||
"\1\57\1\24\1\25\1\26\1\60\1\25\1\30\1\45"+
|
||||
"\1\32\1\46\1\55\1\53\1\54\3\55\1\17\1\36"+
|
||||
"\1\55\1\37\1\55\1\40\7\61\1\62\1\63\2\61"+
|
||||
"\1\63\20\61\27\0\1\64\13\0\1\65\1\66\2\0"+
|
||||
"\1\66\20\0\1\67\3\0\1\70\1\0\1\70\3\0"+
|
||||
"\1\70\5\0\1\67\2\0\3\67\2\0\1\67\1\0"+
|
||||
"\1\67\2\0\1\65\1\0\1\65\3\0\3\65\1\0"+
|
||||
"\1\65\1\0\2\65\12\0\1\65\2\0\1\71\3\0"+
|
||||
"\1\72\1\0\1\72\3\0\1\72\5\0\1\71\2\0"+
|
||||
"\3\71\2\0\1\71\1\0\1\71\2\0\1\65\5\0"+
|
||||
"\2\65\2\0\1\65\34\0\1\73\52\0\1\73\1\74"+
|
||||
"\1\0\3\74\1\75\1\76\1\0\1\77\2\74\1\77"+
|
||||
"\20\74\34\0\1\16\1\0\5\16\2\0\2\16\1\0"+
|
||||
"\20\16\7\22\1\0\24\22\1\16\1\0\5\16\1\100"+
|
||||
"\1\101\2\16\1\101\20\16\10\0\1\25\2\0\1\25"+
|
||||
"\20\0\1\16\1\0\5\16\1\102\1\103\2\16\1\103"+
|
||||
"\20\16\7\0\1\104\1\105\1\0\1\106\1\105\16\0"+
|
||||
"\1\106\16\0\1\107\33\0\1\110\16\0\7\111\1\112"+
|
||||
"\10\111\1\113\1\114\12\111\7\115\1\116\12\115\1\117"+
|
||||
"\11\115\4\0\3\120\1\121\1\122\1\0\1\123\1\122"+
|
||||
"\3\0\1\124\2\0\1\120\2\123\2\120\1\125\1\126"+
|
||||
"\1\0\1\120\10\0\1\127\1\130\1\0\1\131\1\130"+
|
||||
"\16\0\1\131\1\0\1\132\1\0\1\132\1\133\1\132"+
|
||||
"\1\133\1\134\1\0\1\135\1\133\1\132\1\135\1\132"+
|
||||
"\2\133\12\132\1\133\2\132\1\41\1\0\1\41\1\0"+
|
||||
"\3\41\3\0\1\41\1\0\1\41\2\0\12\41\1\0"+
|
||||
"\3\41\1\0\1\41\1\0\3\41\1\100\1\101\1\0"+
|
||||
"\1\41\1\101\1\41\2\0\12\41\1\0\3\41\1\0"+
|
||||
"\1\41\1\0\3\41\1\102\1\103\1\0\1\41\1\103"+
|
||||
"\1\41\2\0\12\41\1\0\2\41\15\0\1\136\33\0"+
|
||||
"\1\137\16\0\1\140\1\0\3\140\1\141\1\142\1\0"+
|
||||
"\1\143\2\140\1\143\20\140\1\47\1\0\5\47\2\0"+
|
||||
"\2\47\1\0\21\47\1\0\5\47\1\100\1\101\2\47"+
|
||||
"\1\101\20\47\20\112\1\144\1\145\12\112\22\116\1\146"+
|
||||
"\11\116\1\147\1\0\1\147\1\150\1\147\1\150\1\151"+
|
||||
"\1\0\1\152\1\150\1\147\1\152\1\147\2\150\12\147"+
|
||||
"\1\150\2\147\1\55\1\0\1\55\1\0\3\55\3\0"+
|
||||
"\1\55\1\0\1\55\2\0\12\55\1\0\3\55\1\0"+
|
||||
"\1\55\1\0\3\55\1\100\1\101\1\0\1\55\1\101"+
|
||||
"\1\55\2\0\12\55\1\0\2\55\7\61\1\0\24\61"+
|
||||
"\7\0\1\153\1\63\2\0\1\63\24\0\3\154\3\0"+
|
||||
"\1\155\4\0\1\156\2\0\1\154\2\155\2\154\1\157"+
|
||||
"\1\160\1\0\1\154\11\0\1\66\2\0\1\66\20\0"+
|
||||
"\1\161\1\0\1\161\1\162\1\161\1\162\1\163\1\0"+
|
||||
"\1\67\1\162\1\161\1\67\1\161\2\162\12\161\1\162"+
|
||||
"\2\161\1\67\1\0\1\67\1\0\3\67\3\0\1\67"+
|
||||
"\1\0\1\67\2\0\12\67\1\0\2\67\1\164\1\0"+
|
||||
"\3\164\1\165\1\166\1\0\1\71\2\164\1\71\20\164"+
|
||||
"\1\71\1\0\5\71\2\0\2\71\1\0\20\71\12\0"+
|
||||
"\1\167\17\0\1\167\1\0\1\74\1\0\4\74\1\76"+
|
||||
"\1\0\1\77\2\74\1\77\20\74\5\0\1\16\26\0"+
|
||||
"\1\16\1\170\5\16\2\170\2\16\1\170\20\16\10\0"+
|
||||
"\1\101\2\0\1\101\30\0\1\103\2\0\1\103\30\0"+
|
||||
"\1\105\2\0\1\105\27\0\1\104\1\105\2\0\1\105"+
|
||||
"\20\0\5\171\1\0\1\171\1\0\1\171\3\0\1\171"+
|
||||
"\2\0\12\171\1\0\2\171\1\172\3\110\1\173\1\110"+
|
||||
"\1\173\1\0\2\110\1\173\3\110\1\174\1\110\1\172"+
|
||||
"\2\110\3\172\2\110\1\172\1\110\1\172\1\110\7\111"+
|
||||
"\1\112\24\111\6\0\1\175\33\0\1\175\13\0\1\115"+
|
||||
"\15\0\3\120\1\121\1\122\1\0\1\120\1\122\3\0"+
|
||||
"\1\124\2\0\5\120\3\0\1\120\11\0\1\122\2\0"+
|
||||
"\1\122\24\0\3\120\1\121\1\122\1\0\1\123\1\122"+
|
||||
"\3\0\1\124\2\0\1\120\2\123\2\120\1\125\2\0"+
|
||||
"\1\120\24\0\1\176\14\0\3\120\3\0\1\120\4\0"+
|
||||
"\1\124\2\0\5\120\3\0\1\120\4\0\4\177\2\0"+
|
||||
"\2\177\4\0\1\200\2\0\6\177\1\0\2\177\11\0"+
|
||||
"\1\130\2\0\1\130\27\0\1\127\1\130\2\0\1\130"+
|
||||
"\20\0\1\132\1\0\1\132\1\133\2\132\1\134\1\0"+
|
||||
"\1\135\1\133\1\132\1\135\1\132\2\133\12\132\1\133"+
|
||||
"\2\132\5\0\1\41\26\0\1\41\1\201\1\41\1\201"+
|
||||
"\3\41\3\201\1\41\1\201\1\41\2\201\12\41\1\201"+
|
||||
"\2\41\5\202\1\0\1\202\1\0\1\202\3\0\1\202"+
|
||||
"\2\0\12\202\1\0\2\202\1\203\3\137\1\204\1\137"+
|
||||
"\1\204\1\0\2\137\1\204\3\137\1\205\1\137\1\203"+
|
||||
"\2\137\3\203\2\137\1\203\1\137\1\203\1\137\1\140"+
|
||||
"\1\0\4\140\1\142\1\0\1\143\2\140\1\143\20\140"+
|
||||
"\5\0\1\47\26\0\34\112\22\0\1\116\11\0\1\147"+
|
||||
"\1\0\1\147\1\150\2\147\1\151\1\0\1\152\1\150"+
|
||||
"\1\147\1\152\1\147\2\150\12\147\1\150\2\147\5\0"+
|
||||
"\1\55\32\0\3\154\3\0\1\154\4\0\1\156\2\0"+
|
||||
"\5\154\3\0\1\154\5\0\3\154\3\0\1\155\4\0"+
|
||||
"\1\156\2\0\1\154\2\155\2\154\1\157\2\0\1\154"+
|
||||
"\24\0\1\206\13\0\4\207\2\0\2\207\4\0\1\210"+
|
||||
"\2\0\6\207\1\0\2\207\1\0\1\161\1\0\1\161"+
|
||||
"\1\162\2\161\1\163\1\0\1\67\1\162\1\161\1\67"+
|
||||
"\1\161\2\162\12\161\1\162\2\161\5\0\1\67\26\0"+
|
||||
"\1\164\1\0\4\164\1\166\1\0\1\71\2\164\1\71"+
|
||||
"\20\164\5\0\1\71\26\0\1\211\3\171\1\212\1\0"+
|
||||
"\1\142\1\0\1\171\1\0\1\212\1\171\2\0\1\213"+
|
||||
"\1\171\1\211\2\171\3\211\2\171\1\211\1\0\1\211"+
|
||||
"\1\171\1\214\1\110\2\214\1\215\1\216\1\173\1\0"+
|
||||
"\1\217\1\214\1\215\1\217\2\214\1\220\15\214\1\172"+
|
||||
"\1\110\2\172\1\215\1\172\1\215\1\0\1\110\1\172"+
|
||||
"\1\215\1\110\2\172\1\221\15\172\1\47\3\0\1\142"+
|
||||
"\1\0\1\142\3\0\1\142\5\0\1\47\2\0\3\47"+
|
||||
"\2\0\1\47\1\0\1\47\24\0\1\120\13\0\4\177"+
|
||||
"\2\0\2\177\1\0\1\222\2\0\1\200\2\0\6\177"+
|
||||
"\1\0\2\177\24\0\1\223\10\0\1\224\3\202\1\225"+
|
||||
"\1\0\1\151\1\0\1\202\1\0\1\225\1\202\2\0"+
|
||||
"\1\226\1\202\1\224\2\202\3\224\2\202\1\224\1\0"+
|
||||
"\1\224\1\202\1\227\1\137\1\227\1\230\1\231\1\230"+
|
||||
"\1\204\1\0\1\232\1\230\1\231\1\232\1\227\1\230"+
|
||||
"\1\233\12\227\1\230\2\227\1\203\1\137\1\203\1\137"+
|
||||
"\1\231\1\203\1\231\1\0\2\137\1\231\1\137\1\203"+
|
||||
"\1\137\1\205\12\203\1\137\2\203\1\55\3\0\1\151"+
|
||||
"\1\0\1\151\3\0\1\151\5\0\1\55\2\0\3\55"+
|
||||
"\2\0\1\55\1\0\1\55\24\0\1\154\13\0\4\207"+
|
||||
"\2\0\2\207\1\0\1\167\2\0\1\210\2\0\6\207"+
|
||||
"\1\0\2\207\24\0\1\234\10\0\1\235\1\171\2\235"+
|
||||
"\1\236\1\141\1\142\1\0\1\237\1\140\1\236\1\237"+
|
||||
"\2\140\1\240\12\235\1\140\2\235\1\211\1\171\2\211"+
|
||||
"\1\236\1\47\1\241\1\0\1\171\1\47\1\236\1\171"+
|
||||
"\2\47\1\242\12\211\1\47\2\211\1\47\3\0\1\142"+
|
||||
"\1\0\1\142\3\0\1\142\3\0\1\174\1\0\1\47"+
|
||||
"\2\0\3\47\2\0\1\47\1\0\1\47\1\0\1\214"+
|
||||
"\1\110\2\214\1\215\1\214\1\173\1\0\1\217\1\214"+
|
||||
"\1\215\1\217\2\214\1\220\16\214\1\110\2\214\1\215"+
|
||||
"\1\214\1\215\1\0\1\217\1\214\1\215\1\217\2\214"+
|
||||
"\1\220\15\214\1\172\3\110\1\173\1\172\1\173\1\0"+
|
||||
"\2\110\1\173\3\110\1\174\1\110\1\172\2\110\3\172"+
|
||||
"\2\110\1\172\1\110\1\172\1\110\1\140\1\0\2\140"+
|
||||
"\1\241\1\140\1\142\1\0\1\143\1\140\1\241\1\143"+
|
||||
"\21\140\1\0\2\140\1\241\1\141\1\142\1\0\1\143"+
|
||||
"\1\140\1\241\1\143\20\140\7\0\1\121\1\122\2\0"+
|
||||
"\1\122\43\0\1\177\10\0\1\243\1\202\1\243\1\244"+
|
||||
"\1\245\1\150\1\151\1\0\1\246\1\150\1\245\1\246"+
|
||||
"\1\147\1\150\1\247\12\243\1\150\2\243\1\224\1\202"+
|
||||
"\1\224\1\202\1\245\1\55\1\250\1\0\1\202\1\0"+
|
||||
"\1\245\1\202\1\55\1\0\1\226\12\224\1\0\2\224"+
|
||||
"\1\55\3\0\1\151\1\0\1\151\3\0\1\151\3\0"+
|
||||
"\1\205\1\0\1\55\2\0\3\55\2\0\1\55\1\0"+
|
||||
"\1\55\1\0\1\227\1\137\1\227\1\230\1\231\1\227"+
|
||||
"\1\204\1\0\1\232\1\230\1\231\1\232\1\227\1\230"+
|
||||
"\1\233\12\227\1\230\2\227\1\203\3\137\1\204\1\203"+
|
||||
"\1\204\1\0\2\137\1\204\3\137\1\205\1\137\1\203"+
|
||||
"\2\137\3\203\2\137\1\203\1\137\1\203\1\137\1\227"+
|
||||
"\1\137\1\227\1\230\1\231\1\227\1\231\1\0\1\232"+
|
||||
"\1\230\1\231\1\232\1\227\1\230\1\233\12\227\1\230"+
|
||||
"\2\227\1\55\3\0\1\151\1\55\1\151\3\0\1\151"+
|
||||
"\5\0\1\55\2\0\3\55\2\0\1\55\1\0\1\55"+
|
||||
"\24\0\1\207\10\0\1\235\1\171\2\235\1\236\1\140"+
|
||||
"\1\142\1\0\1\237\1\140\1\236\1\237\2\140\1\240"+
|
||||
"\12\235\1\140\3\235\1\171\2\235\1\236\1\140\1\241"+
|
||||
"\1\0\1\237\1\140\1\236\1\237\2\140\1\240\12\235"+
|
||||
"\1\140\2\235\1\140\1\0\2\140\1\241\1\140\1\142"+
|
||||
"\1\0\1\143\1\140\1\241\1\143\2\140\1\220\16\140"+
|
||||
"\1\0\4\140\1\241\1\0\1\143\2\140\1\143\21\140"+
|
||||
"\1\0\2\140\1\241\1\141\1\142\1\0\1\143\1\140"+
|
||||
"\1\241\1\143\2\140\1\220\15\140\1\243\1\202\1\243"+
|
||||
"\1\244\1\245\1\147\1\151\1\0\1\246\1\150\1\245"+
|
||||
"\1\246\1\147\1\150\1\247\12\243\1\150\2\243\1\224"+
|
||||
"\3\202\1\225\1\55\1\151\1\0\1\202\1\0\1\225"+
|
||||
"\1\202\2\0\1\226\1\202\1\224\2\202\3\224\2\202"+
|
||||
"\1\224\1\0\1\224\1\202\1\243\1\202\1\243\1\244"+
|
||||
"\1\245\1\147\1\250\1\0\1\246\1\150\1\245\1\246"+
|
||||
"\1\147\1\150\1\247\12\243\1\150\2\243\1\55\3\0"+
|
||||
"\1\151\1\55\1\151\3\0\1\151\3\0\1\205\1\0"+
|
||||
"\1\55\2\0\3\55\2\0\1\55\1\0\1\55\1\0"+
|
||||
"\1\147\1\0\1\147\1\150\2\147\1\250\1\0\1\152"+
|
||||
"\1\150\1\147\1\152\1\147\2\150\12\147\1\150\2\147";
|
||||
|
||||
private static int [] zzUnpackTrans() {
|
||||
int [] result = new int[3696];
|
||||
int [] result = new int[3668];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -374,8 +369,8 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||
"\16\0\1\1\2\11\3\1\1\11\1\1\1\11\3\1"+
|
||||
"\1\11\4\1\1\11\23\1\1\11\2\1\1\11\1\1"+
|
||||
"\15\0\1\1\2\11\3\1\1\11\1\1\1\11\3\1"+
|
||||
"\1\11\4\1\1\11\22\1\1\11\2\1\1\11\1\1"+
|
||||
"\4\0\2\1\1\0\1\1\1\0\1\11\1\1\1\11"+
|
||||
"\1\1\1\11\1\1\6\0\1\1\2\0\1\1\1\0"+
|
||||
"\1\11\1\1\4\0\1\11\1\1\1\0\1\1\1\0"+
|
||||
@@ -387,7 +382,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
"\2\0\1\1";
|
||||
|
||||
private static int [] zzUnpackAttribute() {
|
||||
int [] result = new int[170];
|
||||
int [] result = new int[168];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -905,7 +900,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
case 43: break;
|
||||
case 18:
|
||||
// general lookahead, find correct zzMarkedPos
|
||||
{ int zzFState = 12;
|
||||
{ int zzFState = 11;
|
||||
int zzFPos = zzStartRead;
|
||||
if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; }
|
||||
boolean zzFinL[] = zzFin;
|
||||
@@ -920,7 +915,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
zzFinL[zzFPos++] = false;
|
||||
}
|
||||
|
||||
zzFState = 7;
|
||||
zzFState = 6;
|
||||
zzFPos = zzMarkedPos;
|
||||
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
|
||||
zzInput = Character.codePointBefore(zzBufferL, zzFPos/*, zzStartRead*/);
|
||||
@@ -945,7 +940,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
case 46: break;
|
||||
case 21:
|
||||
// general lookahead, find correct zzMarkedPos
|
||||
{ int zzFState = 6;
|
||||
{ int zzFState = 5;
|
||||
int zzFPos = zzStartRead;
|
||||
if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; }
|
||||
boolean zzFinL[] = zzFin;
|
||||
@@ -960,7 +955,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
zzFinL[zzFPos++] = false;
|
||||
}
|
||||
|
||||
zzFState = 7;
|
||||
zzFState = 6;
|
||||
zzFPos = zzMarkedPos;
|
||||
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
|
||||
zzInput = Character.codePointBefore(zzBufferL, zzFPos/*, zzStartRead*/);
|
||||
@@ -974,7 +969,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
case 47: break;
|
||||
case 22:
|
||||
// general lookahead, find correct zzMarkedPos
|
||||
{ int zzFState = 13;
|
||||
{ int zzFState = 12;
|
||||
int zzFPos = zzStartRead;
|
||||
if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; }
|
||||
boolean zzFinL[] = zzFin;
|
||||
@@ -989,7 +984,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
zzFinL[zzFPos++] = false;
|
||||
}
|
||||
|
||||
zzFState = 7;
|
||||
zzFState = 6;
|
||||
zzFPos = zzMarkedPos;
|
||||
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
|
||||
zzInput = Character.codePointBefore(zzBufferL, zzFPos/*, zzStartRead*/);
|
||||
@@ -1013,7 +1008,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
case 49: break;
|
||||
case 24:
|
||||
// general lookahead, find correct zzMarkedPos
|
||||
{ int zzFState = 10;
|
||||
{ int zzFState = 9;
|
||||
int zzFPos = zzStartRead;
|
||||
if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; }
|
||||
boolean zzFinL[] = zzFin;
|
||||
@@ -1028,7 +1023,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
zzFinL[zzFPos++] = false;
|
||||
}
|
||||
|
||||
zzFState = 11;
|
||||
zzFState = 10;
|
||||
zzFPos = zzMarkedPos;
|
||||
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
|
||||
zzInput = Character.codePointBefore(zzBufferL, zzFPos/*, zzStartRead*/);
|
||||
@@ -1047,7 +1042,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
case 51: break;
|
||||
case 26:
|
||||
// general lookahead, find correct zzMarkedPos
|
||||
{ int zzFState = 8;
|
||||
{ int zzFState = 7;
|
||||
int zzFPos = zzStartRead;
|
||||
if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; }
|
||||
boolean zzFinL[] = zzFin;
|
||||
@@ -1062,7 +1057,7 @@ public class _YAMLLexer implements FlexLexer, YAMLTokenTypes {
|
||||
zzFinL[zzFPos++] = false;
|
||||
}
|
||||
|
||||
zzFState = 9;
|
||||
zzFState = 8;
|
||||
zzFPos = zzMarkedPos;
|
||||
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
|
||||
zzInput = Character.codePointBefore(zzBufferL, zzFPos/*, zzStartRead*/);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.yaml;
|
||||
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IFileElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
|
||||
@@ -32,4 +33,11 @@ public interface YAMLElementTypes {
|
||||
YAMLTokenTypes.TEXT,
|
||||
SCALAR_LIST_VALUE
|
||||
);
|
||||
|
||||
TokenSet BLANK_ELEMENTS = TokenSet.create(
|
||||
YAMLTokenTypes.WHITESPACE,
|
||||
TokenType.WHITE_SPACE,
|
||||
YAMLTokenTypes.EOL,
|
||||
YAMLTokenTypes.INDENT,
|
||||
YAMLTokenTypes.COMMENT);
|
||||
}
|
||||
|
||||
@@ -260,6 +260,10 @@ C_NS_TAG_PROPERTY = {C_VERBATIM_TAG} | {C_NS_SHORTHAND_TAG} | {C_NON_SPECIFIC_TA
|
||||
return tokenOrForbidden(TEXT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<YYINITIAL, BRACES, VALUE_OR_KEY> {
|
||||
|
||||
"-" / ({WHITE_SPACE} | {EOL}) { yyBegin(VALUE_OR_KEY);
|
||||
return SEQUENCE_MARKER; }
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.yaml.psi.impl;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -16,7 +17,7 @@ import java.util.List;
|
||||
|
||||
public abstract class YAMLBlockScalarImpl extends YAMLScalarImpl {
|
||||
protected static final int DEFAULT_CONTENT_INDENT = 2;
|
||||
|
||||
|
||||
public YAMLBlockScalarImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -32,13 +33,17 @@ public abstract class YAMLBlockScalarImpl extends YAMLScalarImpl {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> getContentRanges() {
|
||||
final int myStart = getTextOffset();
|
||||
final ASTNode node = getNode();
|
||||
final ASTNode firstContentChild = getFirstContentNode();
|
||||
if (firstContentChild == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final int myStart = getTextRange().getStartOffset();
|
||||
final List<TextRange> result = new ArrayList<>();
|
||||
|
||||
final int indent = locateIndent();
|
||||
|
||||
final ASTNode firstEol = node.findChildByType(YAMLTokenTypes.EOL);
|
||||
final ASTNode firstEol = TreeUtil.findSibling(firstContentChild, YAMLTokenTypes.EOL);
|
||||
if (firstEol == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -47,7 +52,7 @@ public abstract class YAMLBlockScalarImpl extends YAMLScalarImpl {
|
||||
for (ASTNode child = firstEol.getTreeNext(); child != null; child = child.getTreeNext()) {
|
||||
final IElementType childType = child.getElementType();
|
||||
final TextRange childRange = child.getTextRange();
|
||||
|
||||
|
||||
if (childType == YAMLTokenTypes.INDENT && isEol(child.getTreePrev())) {
|
||||
thisLineStart = child.getStartOffset() + Math.min(indent, child.getTextLength());
|
||||
}
|
||||
@@ -89,7 +94,7 @@ public abstract class YAMLBlockScalarImpl extends YAMLScalarImpl {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isEol(@Nullable ASTNode node) {
|
||||
return node != null && node.getElementType() == YAMLTokenTypes.EOL;
|
||||
}
|
||||
|
||||
@@ -21,12 +21,11 @@ public class YAMLPlainTextImpl extends YAMLScalarImpl implements YAMLScalar {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> getContentRanges() {
|
||||
final int myStart = getTextOffset();
|
||||
final ASTNode node = getNode();
|
||||
final int myStart = getTextRange().getStartOffset();
|
||||
final List<TextRange> result = new ArrayList<>();
|
||||
|
||||
boolean seenText = false;
|
||||
for (ASTNode child = node.getFirstChildNode(); child != null; child = child.getTreeNext()) {
|
||||
for (ASTNode child = getFirstContentNode(); child != null; child = child.getTreeNext()) {
|
||||
if (child.getElementType() == YAMLTokenTypes.TEXT) {
|
||||
seenText = true;
|
||||
result.add(child.getTextRange().shiftRight(-myStart));
|
||||
@@ -52,7 +51,7 @@ public class YAMLPlainTextImpl extends YAMLScalarImpl implements YAMLScalar {
|
||||
return " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean isNewline(@NotNull CharSequence text, @NotNull TextRange range) {
|
||||
return range.getLength() == 1 && text.charAt(range.getStartOffset()) == '\n';
|
||||
}
|
||||
@@ -79,10 +78,10 @@ public class YAMLPlainTextImpl extends YAMLScalarImpl implements YAMLScalar {
|
||||
currentLength = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
currentLength++;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.yaml.lexer.YAMLGrammarCharUtil;
|
||||
import org.jetbrains.yaml.psi.YAMLQuotedText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -22,17 +23,25 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
|
||||
public YAMLQuotedTextImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
myIsSingleQuoted = getNode().getFirstChildNode().getElementType() == YAMLTokenTypes.SCALAR_STRING;
|
||||
final ASTNode firstContentNode = getFirstContentNode();
|
||||
myIsSingleQuoted = firstContentNode != null && firstContentNode.getElementType() == YAMLTokenTypes.SCALAR_STRING;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<TextRange> getContentRanges() {
|
||||
List<TextRange> result = new ArrayList<>();
|
||||
final ASTNode firstContentNode = getFirstContentNode();
|
||||
if (firstContentNode == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final List<String> lines = StringUtil.split(getText(), "\n", true, false);
|
||||
List<TextRange> result = new ArrayList<>();
|
||||
TextRange contentRange = TextRange.create(firstContentNode.getStartOffset(), getTextRange().getEndOffset())
|
||||
.shiftRight(-getTextRange().getStartOffset());
|
||||
|
||||
final List<String> lines = StringUtil.split(contentRange.substring(getText()), "\n", true, false);
|
||||
// First line has opening quote
|
||||
int cumulativeOffset = 0;
|
||||
int cumulativeOffset = contentRange.getStartOffset();
|
||||
for (int i = 0; i < lines.size(); ++i) {
|
||||
final String line = lines.get(i);
|
||||
|
||||
@@ -82,9 +91,9 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
@Override
|
||||
protected List<Pair<TextRange, String>> getDecodeReplacements(@NotNull CharSequence input) {
|
||||
List<Pair<TextRange, String>> result = new ArrayList<>();
|
||||
|
||||
|
||||
for (int i = 0; i + 1 < input.length(); ++i) {
|
||||
|
||||
|
||||
if (isSingleQuote() && input.charAt(i) == '\'' && input.charAt(i + 1) == '\'') {
|
||||
result.add(Pair.create(TextRange.from(i, 2), "'"));
|
||||
i++;
|
||||
@@ -115,10 +124,10 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final int indent = YAMLUtil.getIndentToThisElement(this);
|
||||
final String indentString = StringUtil.repeatSymbol(' ', indent);
|
||||
|
||||
|
||||
final List<Pair<TextRange, String>> result = new ArrayList<>();
|
||||
int currentLength = 0;
|
||||
for (int i = 0; i < input.length(); ++i) {
|
||||
@@ -138,7 +147,7 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
}
|
||||
|
||||
|
||||
if (currentLength > MAX_SCALAR_LENGTH_PREDEFINED
|
||||
if (currentLength > MAX_SCALAR_LENGTH_PREDEFINED
|
||||
&& (!isSingleQuote() || (c == ' ' && isSurroundedByNoSpace(input, i)))) {
|
||||
final String replacement;
|
||||
if (isSingleQuote()) {
|
||||
@@ -155,12 +164,12 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
}
|
||||
|
||||
currentLength++;
|
||||
|
||||
|
||||
if (isSingleQuote() && c == '\'') {
|
||||
result.add(Pair.create(TextRange.from(i, 1), "''"));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!isSingleQuote()) {
|
||||
if (c == '"') {
|
||||
result.add(Pair.create(TextRange.from(i, 1), "\\\""));
|
||||
@@ -186,7 +195,7 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
public String toString() {
|
||||
return "YAML quoted text";
|
||||
}
|
||||
|
||||
|
||||
private static class Escaper {
|
||||
private static final int[][] ONE_LETTER_CONVERSIONS = new int[][] {
|
||||
{'0', 0},
|
||||
@@ -208,7 +217,7 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
{'L', 8232},
|
||||
{'P', 8233},
|
||||
};
|
||||
|
||||
|
||||
private static final NotNullLazyValue<Map<Integer, Integer>> ESC_TO_CODE = new NotNullLazyValue<Map<Integer, Integer>>() {
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -232,12 +241,12 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
return map;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static int findEscapementLength(@NotNull CharSequence text, int pos) {
|
||||
if (pos + 1 >= text.length() || text.charAt(pos) != '\\') {
|
||||
throw new IllegalArgumentException("This is not an escapement start");
|
||||
}
|
||||
|
||||
|
||||
final char c = text.charAt(pos + 1);
|
||||
if (c == 'x') {
|
||||
return 3;
|
||||
@@ -252,7 +261,7 @@ public class YAMLQuotedTextImpl extends YAMLScalarImpl implements YAMLQuotedText
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int toUnicodeChar(@NotNull CharSequence text, int pos, int length) {
|
||||
if (length > 1) {
|
||||
CharSequence s = text.subSequence(pos + 2, Math.min(text.length(), pos + length + 1));
|
||||
|
||||
@@ -10,6 +10,9 @@ import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.yaml.YAMLElementTypes;
|
||||
import org.jetbrains.yaml.YAMLTokenTypes;
|
||||
import org.jetbrains.yaml.lexer.YAMLGrammarCharUtil;
|
||||
import org.jetbrains.yaml.psi.YAMLScalar;
|
||||
|
||||
@@ -18,7 +21,7 @@ import java.util.List;
|
||||
|
||||
public abstract class YAMLScalarImpl extends YAMLValueImpl implements YAMLScalar {
|
||||
protected static final int MAX_SCALAR_LENGTH_PREDEFINED = 60;
|
||||
|
||||
|
||||
public YAMLScalarImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -28,11 +31,11 @@ public abstract class YAMLScalarImpl extends YAMLValueImpl implements YAMLScalar
|
||||
|
||||
@NotNull
|
||||
protected abstract String getRangesJoiner(@NotNull CharSequence text, @NotNull List<TextRange> contentRanges, int indexBefore);
|
||||
|
||||
|
||||
protected List<Pair<TextRange, String>> getDecodeReplacements(@NotNull CharSequence input) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
protected List<Pair<TextRange, String>> getEncodeReplacements(@NotNull CharSequence input) throws IllegalArgumentException {
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
}
|
||||
@@ -47,7 +50,7 @@ public abstract class YAMLScalarImpl extends YAMLValueImpl implements YAMLScalar
|
||||
|
||||
for (int i = 0; i < contentRanges.size(); i++) {
|
||||
final TextRange range = contentRanges.get(i);
|
||||
|
||||
|
||||
final CharSequence curString = range.subSequence(text);
|
||||
builder.append(curString);
|
||||
|
||||
@@ -85,10 +88,10 @@ public abstract class YAMLScalarImpl extends YAMLValueImpl implements YAMLScalar
|
||||
public LiteralTextEscaper<? extends PsiLanguageInjectionHost> createLiteralTextEscaper() {
|
||||
return new MyLiteralTextEscaper(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static String processReplacements(@NotNull CharSequence input,
|
||||
@NotNull List<Pair<TextRange, String>> replacements) throws IndexOutOfBoundsException {
|
||||
|
||||
@NotNull
|
||||
static String processReplacements(@NotNull CharSequence input,
|
||||
@NotNull List<Pair<TextRange, String>> replacements) throws IndexOutOfBoundsException {
|
||||
StringBuilder result = new StringBuilder();
|
||||
int currentOffset = 0;
|
||||
for (Pair<TextRange, String> replacement : replacements) {
|
||||
@@ -105,6 +108,16 @@ public abstract class YAMLScalarImpl extends YAMLValueImpl implements YAMLScalar
|
||||
&& (pos + 1 >= text.length() || !YAMLGrammarCharUtil.isSpaceLike(text.charAt(pos + 1)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected final ASTNode getFirstContentNode() {
|
||||
ASTNode node = getNode().getFirstChildNode();
|
||||
while (node != null && (
|
||||
node.getElementType() == YAMLTokenTypes.TAG || YAMLElementTypes.BLANK_ELEMENTS.contains(node.getElementType()))) {
|
||||
node = node.getTreeNext();
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private static class MyLiteralTextEscaper extends LiteralTextEscaper<YAMLScalarImpl> {
|
||||
public MyLiteralTextEscaper(YAMLScalarImpl scalar) {
|
||||
super(scalar);
|
||||
@@ -120,7 +133,7 @@ public abstract class YAMLScalarImpl extends YAMLValueImpl implements YAMLScalar
|
||||
public int getOffsetInHost(int offsetInDecoded, @NotNull TextRange rangeInsideHost) {
|
||||
final String text = myHost.getText();
|
||||
final List<TextRange> contentRanges = myHost.getContentRanges();
|
||||
|
||||
|
||||
int currentOffsetInDecoded = 0;
|
||||
|
||||
for (int i = 0; i < contentRanges.size(); i++) {
|
||||
|
||||
@@ -161,6 +161,10 @@ public class YAMLLexerTest extends LexerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testRuby19105() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEmptyMultiline() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
@@ -204,7 +208,7 @@ public class YAMLLexerTest extends LexerTestCase {
|
||||
public void testSingleQuotedEscapes() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testUnicodeNewlines() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
- ('-')
|
||||
whitespace (' ')
|
||||
- ('-')
|
||||
whitespace (' ')
|
||||
scalar key ('Ref:')
|
||||
whitespace (' ')
|
||||
text ('hostedZoneName')
|
||||
Eol ('\n')
|
||||
indent (' ')
|
||||
- ('-')
|
||||
whitespace (' ')
|
||||
text ('a')
|
||||
@@ -0,0 +1,2 @@
|
||||
- - Ref: hostedZoneName
|
||||
- a
|
||||
@@ -135,6 +135,13 @@ public class YAMLParserTest extends ParsingTestCase {
|
||||
"bar: \"baz\"");
|
||||
}
|
||||
|
||||
public void testRuby19105() throws Throwable {
|
||||
doCodeTest("'Fn::Join':\n" +
|
||||
" - ''\n" +
|
||||
" - - Ref: hostedZoneName\n" +
|
||||
" - a");
|
||||
}
|
||||
|
||||
public void testRuby15345() throws IOException {
|
||||
doCodeTest("- !qualified.class.name\n" +
|
||||
" propertyOne: bla bla\n" +
|
||||
@@ -176,7 +183,7 @@ public class YAMLParserTest extends ParsingTestCase {
|
||||
public void testStringWithTag() throws IOException {
|
||||
doCodeTest("foo: ! \"tratata\"");
|
||||
}
|
||||
|
||||
|
||||
public void testIncompleteKeyWithWhitespace() throws IOException {
|
||||
doCodeTest("logging:\n" +
|
||||
" config:\n" +
|
||||
@@ -201,23 +208,23 @@ public class YAMLParserTest extends ParsingTestCase {
|
||||
public void testAnsibleRoleElkMain() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
public void testBlockMapping() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
public void testIncompleteKeyInHierarchy() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
public void testKeyValueWithEmptyLineAhead() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
public void testMultipleDocsWithMappings() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
public void testScalarsWithNewlines() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
YAML file
|
||||
YAML document
|
||||
YAML mapping
|
||||
YAML key value
|
||||
PsiElement(scalar key)(''Fn::Join':')
|
||||
PsiElement(Eol)('\n')
|
||||
PsiElement(indent)(' ')
|
||||
YAML sequence
|
||||
YAML sequence item
|
||||
PsiElement(-)('-')
|
||||
PsiWhiteSpace(' ')
|
||||
YAML quoted text
|
||||
PsiElement(scalar string)('''')
|
||||
PsiElement(Eol)('\n')
|
||||
PsiElement(indent)(' ')
|
||||
YAML sequence item
|
||||
PsiElement(-)('-')
|
||||
PsiWhiteSpace(' ')
|
||||
YAML sequence
|
||||
YAML sequence item
|
||||
PsiElement(-)('-')
|
||||
PsiWhiteSpace(' ')
|
||||
YAML mapping
|
||||
YAML key value
|
||||
PsiElement(scalar key)('Ref:')
|
||||
PsiWhiteSpace(' ')
|
||||
YAML plain scalar text
|
||||
PsiElement(text)('hostedZoneName')
|
||||
PsiElement(Eol)('\n')
|
||||
PsiElement(indent)(' ')
|
||||
YAML sequence item
|
||||
PsiElement(-)('-')
|
||||
PsiWhiteSpace(' ')
|
||||
YAML plain scalar text
|
||||
PsiElement(text)('a')
|
||||
@@ -30,6 +30,10 @@ public class YAMLScalarContentTest extends LightPlatformCodeInsightFixtureTestCa
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPlainScalar3Tag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testLiteralStyle1() {
|
||||
doTest();
|
||||
}
|
||||
@@ -57,7 +61,11 @@ public class YAMLScalarContentTest extends LightPlatformCodeInsightFixtureTestCa
|
||||
public void testFoldedStyle4() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testFoldedStyle4Tag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFoldedStyle5() {
|
||||
doTest();
|
||||
}
|
||||
@@ -70,6 +78,10 @@ public class YAMLScalarContentTest extends LightPlatformCodeInsightFixtureTestCa
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSingleQuote1Tag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSingleQuote2() {
|
||||
doTest();
|
||||
}
|
||||
@@ -77,15 +89,19 @@ public class YAMLScalarContentTest extends LightPlatformCodeInsightFixtureTestCa
|
||||
public void testDoubleQuote1() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testDoubleQuote2() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testDoubleQuote4() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoubleQuoteTag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(getTestName(true) + ".yml");
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ public class YAMLScalarLiteralEscaperTest extends LightPlatformCodeInsightFixtur
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPlainScalar3Tag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testLiteralStyle1() {
|
||||
doTest();
|
||||
}
|
||||
@@ -78,10 +82,18 @@ public class YAMLScalarLiteralEscaperTest extends LightPlatformCodeInsightFixtur
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFoldedStyle4Tag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSingleQuote1() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSingleQuote1Tag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSingleQuote2() {
|
||||
doTest();
|
||||
}
|
||||
@@ -89,15 +101,19 @@ public class YAMLScalarLiteralEscaperTest extends LightPlatformCodeInsightFixtur
|
||||
public void testDoubleQuote1() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testDoubleQuote2() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testDoubleQuote3() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoubleQuoteTag() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(getTestName(true) + ".yml");
|
||||
|
||||
@@ -112,12 +128,12 @@ public class YAMLScalarLiteralEscaperTest extends LightPlatformCodeInsightFixtur
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
assertTrue(elementLiteralEscaper.decode(scalarElement.getTextRange(), builder));
|
||||
assertEquals(scalarElement.getTextValue(), builder.toString());
|
||||
|
||||
|
||||
int[] offsets = new int[builder.length() + 1];
|
||||
for (int i = 0; i < builder.length() + 1; ++i) {
|
||||
offsets[i] = elementLiteralEscaper.getOffsetInHost(i, TextRange.from(0, scalarElement.getTextLength()));
|
||||
}
|
||||
|
||||
|
||||
final String elementText = scalarElement.getText();
|
||||
StringBuilder description = new StringBuilder();
|
||||
for (int i = 0; i < builder.length(); ++i) {
|
||||
@@ -126,8 +142,8 @@ public class YAMLScalarLiteralEscaperTest extends LightPlatformCodeInsightFixtur
|
||||
.append(elementText.subSequence(offsets[i], offsets[i + 1]))
|
||||
.append('\n');
|
||||
}
|
||||
assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".positions.txt",
|
||||
Arrays.toString(offsets) + "\n" + description,
|
||||
assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".positions.txt",
|
||||
Arrays.toString(offsets) + "\n" + description,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[6, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
|
||||
|
||||
->\n
|
||||
|
||||
->\n
|
||||
'->'
|
||||
'->'
|
||||
c->c
|
||||
o->o
|
||||
n->n
|
||||
t->t
|
||||
e->e
|
||||
n->n
|
||||
t->t
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
''content
|
||||
@@ -0,0 +1 @@
|
||||
!Tag "\n\n''content"
|
||||
@@ -0,0 +1,86 @@
|
||||
[7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 76, 77, 78, 79, 80, 80]
|
||||
|
||||
->
|
||||
|
||||
f->f
|
||||
o->o
|
||||
l->l
|
||||
d->d
|
||||
e->e
|
||||
d->d
|
||||
->
|
||||
|
||||
l->l
|
||||
i->i
|
||||
n->n
|
||||
e->e
|
||||
|
||||
|
||||
->
|
||||
|
||||
n->n
|
||||
e->e
|
||||
x->x
|
||||
t->t
|
||||
->
|
||||
|
||||
l->l
|
||||
i->i
|
||||
n->n
|
||||
e->e
|
||||
|
||||
->
|
||||
|
||||
->
|
||||
->
|
||||
*->*
|
||||
->
|
||||
b->b
|
||||
u->u
|
||||
l->l
|
||||
l->l
|
||||
e->e
|
||||
t->t
|
||||
|
||||
->
|
||||
|
||||
|
||||
->
|
||||
|
||||
->
|
||||
->
|
||||
*->*
|
||||
->
|
||||
l->l
|
||||
i->i
|
||||
s->s
|
||||
t->t
|
||||
|
||||
->
|
||||
|
||||
->
|
||||
->
|
||||
*->*
|
||||
->
|
||||
l->l
|
||||
i->i
|
||||
n->n
|
||||
e->e
|
||||
|
||||
->
|
||||
|
||||
|
||||
->
|
||||
|
||||
l->l
|
||||
a->a
|
||||
s->s
|
||||
t->t
|
||||
->
|
||||
|
||||
l->l
|
||||
i->i
|
||||
n->n
|
||||
e->e
|
||||
|
||||
->
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
folded line
|
||||
next line
|
||||
* bullet
|
||||
|
||||
* list
|
||||
* line
|
||||
|
||||
last line
|
||||
@@ -0,0 +1,16 @@
|
||||
!Tag >
|
||||
|
||||
folded
|
||||
line
|
||||
|
||||
next
|
||||
line
|
||||
* bullet
|
||||
|
||||
* list
|
||||
* line
|
||||
|
||||
last
|
||||
line
|
||||
|
||||
# Comment
|
||||
@@ -0,0 +1,30 @@
|
||||
[5, 6, 7, 8, 13, 14, 15, 16, 19, 20, 21, 23, 26, 27, 28, 30, 33, 34, 35, 36, 37, 38]
|
||||
f->f
|
||||
o->o
|
||||
o->o
|
||||
->
|
||||
|
||||
b->b
|
||||
a->a
|
||||
r->r
|
||||
->
|
||||
|
||||
f->f
|
||||
a->a
|
||||
r->r
|
||||
|
||||
|
||||
->
|
||||
|
||||
b->b
|
||||
a->a
|
||||
z->z
|
||||
|
||||
|
||||
->
|
||||
|
||||
b->b
|
||||
a->a
|
||||
a->a
|
||||
a->a
|
||||
z->z
|
||||
@@ -0,0 +1,3 @@
|
||||
foo bar far
|
||||
baz
|
||||
baaaz
|
||||
@@ -0,0 +1,7 @@
|
||||
- !Tag foo
|
||||
bar<caret>
|
||||
far
|
||||
|
||||
baz
|
||||
|
||||
baaaz
|
||||
@@ -0,0 +1,19 @@
|
||||
[6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
|
||||
h->h
|
||||
e->e
|
||||
r->r
|
||||
e->e
|
||||
'->''
|
||||
s->s
|
||||
->
|
||||
t->t
|
||||
o->o
|
||||
->
|
||||
"->"
|
||||
q->q
|
||||
u->u
|
||||
o->o
|
||||
t->t
|
||||
e->e
|
||||
s->s
|
||||
"->"
|
||||
@@ -0,0 +1 @@
|
||||
here's to "quotes"
|
||||
@@ -0,0 +1 @@
|
||||
!Tag 'here''s to "quotes"'
|
||||
@@ -101,7 +101,13 @@ public class PyEmacsHandler implements EmacsProcessingHandler {
|
||||
}
|
||||
|
||||
ChangeIndentContext context = new ChangeIndentContext(project, file, editor, document, caretLine);
|
||||
|
||||
int targetLineIndent = getLineIndent(context, context.targetLine);
|
||||
int soleLineIndent = getSoleIndent(context);
|
||||
int lineStart = context.document.getLineStartOffset(context.targetLine);
|
||||
if (caretOffset - lineStart < targetLineIndent) {
|
||||
changeIndent(context, soleLineIndent);
|
||||
return Result.STOP;
|
||||
}
|
||||
switch (tryToIndentToRight(context)) {
|
||||
case STOP_SUCCESSFUL: return Result.STOP;
|
||||
case STOP_UNSUCCESSFUL: return Result.CONTINUE;
|
||||
|
||||
@@ -70,6 +70,7 @@ public class PyPackageRequirementsInspection extends PyInspection {
|
||||
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
|
||||
boolean isOnTheFly,
|
||||
@NotNull LocalInspectionToolSession session) {
|
||||
if (!(holder.getFile() instanceof PyFile) && !(holder.getFile() instanceof PsiPlainTextFile)) return PsiElementVisitor.EMPTY_VISITOR;
|
||||
return new Visitor(holder, session, ignoredPackages);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PyEmacsTabTest extends PyTestCase {
|
||||
" print n<caret>ame"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public void testIndentToRight() {
|
||||
doTest(
|
||||
"def test(name):\n" +
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
This inspection helps to convert unmodifiable collections created before Java 9 to new collection factory methods
|
||||
like <code>List.of</code> or <code>Set.of</code>.
|
||||
<!-- tooltip end -->
|
||||
<p>Note that Java 9 collection factory methods do not accept null values. Also set elements and map keys are required to be different.
|
||||
It's not always possible to statically check whether original elements are different and not null. Using the checkbox you may enforce
|
||||
the inspection to warn only if original elements are compile-time constants, so the conversion is guaranteed to be correct.</p>
|
||||
<p>This inspection is available since Java 9 only.</p>
|
||||
<small>New in 2017.2</small>
|
||||
</body>
|
||||
|
||||
@@ -857,9 +857,9 @@
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids8" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.java18api.Java8MapForEachInspection"
|
||||
displayName="Replace with Map.forEach"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="Java9CollectionFactory"
|
||||
<localInspection groupPath="Java,Java language level migration aids" language="JAVA" shortName="Java9CollectionFactory"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids9" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.java19api.Java9CollectionFactoryInspection"
|
||||
displayName="Immutable collection creation can be replaced with collection factory call"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ExcessiveLambdaUsage"
|
||||
|
||||
@@ -25,10 +25,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author yole
|
||||
*/
|
||||
public class HtmlCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
|
||||
public static final String DISPLAY_NAME = ApplicationBundle.message("title.html");
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
|
||||
return new CodeStyleAbstractConfigurable(settings, originalSettings, ApplicationBundle.message("title.html")) {
|
||||
return new CodeStyleAbstractConfigurable(settings, originalSettings, DISPLAY_NAME) {
|
||||
@Override
|
||||
protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
|
||||
return new HtmlCodeStyleMainPanel(settings, originalSettings);
|
||||
@@ -43,6 +46,6 @@ public class HtmlCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
return ApplicationBundle.message("title.html");
|
||||
return DISPLAY_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user