mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
WEB-53334: useless filetype removed; jsonc compliance problems test added
GitOrigin-RevId: c8c46880e28686595db3249c375d0ffb8f89cd00
This commit is contained in:
committed by
intellij-monorepo-bot
parent
62f4e8bf36
commit
635a04ce33
@@ -188,6 +188,8 @@
|
||||
<bundleName>messages.JsonBundle</bundleName>
|
||||
<categoryKey>json.intention.category.name</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<json.jsonStandardComplianceProvider implementation="com.intellij.json.jsonc.JsoncComplianceProvider"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="JavaScript">
|
||||
|
||||
@@ -3,10 +3,15 @@ package com.intellij.json.jsonc
|
||||
|
||||
import com.intellij.json.codeinsight.JsonStandardComplianceProvider
|
||||
import com.intellij.psi.PsiComment
|
||||
import com.intellij.psi.util.PsiUtilCore
|
||||
|
||||
class JsoncComplianceProvider : JsonStandardComplianceProvider() {
|
||||
private val JSONC_DEFAULT_EXTENSION = "jsonc"
|
||||
|
||||
override fun isCommentAllowed(comment: PsiComment): Boolean {
|
||||
if (comment.containingFile.virtualFile.nameSequence.endsWith(JsoncFileType.DEFAULT_EXTENSION)) {
|
||||
val virtualFile = PsiUtilCore.getVirtualFile(comment)
|
||||
|
||||
if (virtualFile?.extension == JSONC_DEFAULT_EXTENSION) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.json.jsonc
|
||||
|
||||
import com.intellij.json.JsonFileType
|
||||
|
||||
class JsoncFileType : JsonFileType() {
|
||||
companion object {
|
||||
val DEFAULT_EXTENSION = "jsonc"
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
return "JSONC"
|
||||
}
|
||||
|
||||
override fun getDefaultExtension(): String {
|
||||
return DEFAULT_EXTENSION
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,9 @@ class JsoncHighlightingTest : JsonHighlightingTestBase() {
|
||||
myFixture.enableInspections(JsonStandardComplianceInspection())
|
||||
doTestHighlighting(false, true, true)
|
||||
}
|
||||
|
||||
fun testJsoncComplianceProblems() {
|
||||
myFixture.enableInspections(JsonStandardComplianceInspection())
|
||||
doTestHighlighting(false, true, true)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"key1": "foo",
|
||||
<error descr="JSON standard allows only double quoted string as property key"><error descr="JSON standard does not allow single quoted strings">'key2'</error></error>: null
|
||||
}
|
||||
Reference in New Issue
Block a user