IDEA-134372 Do not warn about scalar top-level values in JSON files (according to...
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Tue, 27 Jan 2015 13:34:51 +0000 (16:34 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Wed, 28 Jan 2015 10:11:04 +0000 (13:11 +0300)
json/resources/inspectionDescriptions/JsonStandardCompliance.html
json/src/com/intellij/json/JsonBundle.properties
json/src/com/intellij/json/codeinsight/JsonStandardComplianceInspection.java
json/tests/test/com/intellij/json/JsonHighlightingTest.java
json/tests/testData/highlighting/ComplianceProblemsLiteralTopLevelValueIsAllowed.json [new file with mode: 0644]
json/tests/testData/highlighting/ComplianceProblemsTopLevelValue.json [deleted file]

index dc5855374bda78ec701c5df407c6096748ebcbd9..12ca8a1796f5a6aeca647bec6e8acabc66b73f52 100644 (file)
@@ -1,5 +1,5 @@
 <html>
 <body>
-This inspection checks that *.json files comply with JSON specification (RFC-4627). <br>
+This inspection checks that JSON files conform to language specification (RFC-7159).<br>
 </body>
 </html>
\ No newline at end of file
index eda0a292162b1d58259fe044120351cae4be4afa..be56875b9138b858ee149a29180e3439354c02b9 100644 (file)
@@ -9,7 +9,6 @@ msg.illegal.floating.point.literal=Illegal floating point literal
 
 msg.compliance.problem.comments=JSON standard does not allow comments. Use JSMin or similar tool to remove comments before parsing.
 msg.compliance.problem.single.quoted.strings=JSON standard does not allow single quoted strings
-msg.compliance.problem.illegal.top.level.value=JSON standard allows only object or array as top-level value
 msg.compliance.problem.identifier=JSON standard does not allow identifiers
 msg.compliance.problem.illegal.property.key=JSON standard allows only double quoted string as property key
 msg.compliance.problem.trailing.comma=JSON standard does not allow trailing comma
index e3b40235156962dec99f402bf7c5ddad8893fb51..58dab5945dfc6061cdd9abf7541bd1a35b80086d 100644 (file)
@@ -72,9 +72,6 @@ public class JsonStandardComplianceInspection extends LocalInspectionTool {
 
       @Override
       public void visitLiteral(@NotNull JsonLiteral literal) {
-        if (literal.getParent() instanceof JsonFile) {
-          holder.registerProblem(literal, JsonBundle.message("msg.compliance.problem.illegal.top.level.value"));
-        }
         if (JsonPsiUtil.isPropertyKey(literal) && !JsonPsiUtil.getElementTextWithoutHostEscaping(literal).startsWith("\"")) {
           holder.registerProblem(literal, JsonBundle.message("msg.compliance.problem.illegal.property.key"), new AddDoubleQuotesFix());
         }
index 55669514cf2d047b5b01634c8b6a8dd564ea32a7..cd06086e26889990e9183244243dc323df0f728d 100644 (file)
@@ -25,7 +25,8 @@ public class JsonHighlightingTest extends JsonTestCase {
     doTest();
   }
 
-  public void testComplianceProblemsTopLevelValue() {
+  // IDEA-134372
+  public void testComplianceProblemsLiteralTopLevelValueIsAllowed() {
     enableStandardComplianceInspection(true);
     doTest();
   }
diff --git a/json/tests/testData/highlighting/ComplianceProblemsLiteralTopLevelValueIsAllowed.json b/json/tests/testData/highlighting/ComplianceProblemsLiteralTopLevelValueIsAllowed.json
new file mode 100644 (file)
index 0000000..ec747fa
--- /dev/null
@@ -0,0 +1 @@
+null
\ No newline at end of file
diff --git a/json/tests/testData/highlighting/ComplianceProblemsTopLevelValue.json b/json/tests/testData/highlighting/ComplianceProblemsTopLevelValue.json
deleted file mode 100644 (file)
index 211a7b5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<error descr="JSON standard allows only object or array as top-level value">null</error>
\ No newline at end of file