Skip to content

Commit

Permalink
[jsonpath] IDEA-321687 Extract JsonPath plugin
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 322f27fa98def5b2adb4eba0dbbc16be147ebb15
  • Loading branch information
jreznot authored and intellij-monorepo-bot committed Jun 11, 2023
1 parent f16513c commit 09003c4
Show file tree
Hide file tree
Showing 135 changed files with 233 additions and 158 deletions.
1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions intellij.idea.community.main.iml
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,6 @@
<orderEntry type="module" module-name="intellij.html.tools.tests" scope="TEST" />
<orderEntry type="module" module-name="intellij.lombok" scope="TEST" />
<orderEntry type="module" module-name="intellij.xml.xmlbeans" scope="TEST" />
<orderEntry type="module" module-name="intellij.jsonpath" scope="TEST" />
</component>
</module>
1 change: 0 additions & 1 deletion json/intellij.json.iml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.codeStyle.impl" />
<orderEntry type="library" name="jsonpath" level="project" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
Expand Down
43 changes: 0 additions & 43 deletions json/resources/intellij.json.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
<add-to-group group-id="EditorTabPopupMenu" anchor="after" relative-to-action="CopyReference"/>
<add-to-group group-id="EditorPopupMenu" anchor="after" relative-to-action="Copy.Paste.Special"/>
</action>

<action id="JsonPathEvaluateAction" class="com.intellij.jsonpath.ui.JsonPathEvaluateAction" icon="AllIcons.FileTypes.Json">
<add-to-group group-id="FindMenuGroup" anchor="after" relative-to-action="StructuralSearchActions" />
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
</action>

<action id="JsonPathExportEvaluateResultAction" class="com.intellij.jsonpath.ui.JsonPathExportEvaluateResultAction"
use-shortcut-of="ExportToTextFile" icon="AllIcons.Actions.MenuSaveall">
<add-to-group group-id="EditorContextBarMenu"/>
</action>
</actions>

<actions resource-bundle="messages.JsonBundle">
Expand Down Expand Up @@ -155,39 +145,6 @@

<psi.referenceContributor language="JSON" implementation="com.intellij.json.JsonWebReferenceContributor"/>

<lang.parserDefinition language="JSONPath" implementationClass="com.intellij.jsonpath.psi.JsonPathParserDefinition"/>
<lang.braceMatcher language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathPairedBraceMatcher"/>
<lang.quoteHandler language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathQuoteHandler"/>
<lang.syntaxHighlighterFactory language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathSyntaxHighlighterFactory"/>
<annotator language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathFunctionCallAnnotator"/>
<colorSettingsPage implementation="com.intellij.jsonpath.JsonPathColorSettingsPage"/>
<completion.contributor language="JSONPath" order="last" implementationClass="com.intellij.jsonpath.JsonPathCompletionContributor"/>
<spellchecker.support language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathSpellcheckerStrategy"/>

<localInspection language="JSONPath" shortName="JsonPathUnknownFunction"
implementationClass="com.intellij.jsonpath.inspections.JsonPathUnknownFunctionInspection"
bundle="messages.JsonBundle" key="inspection.jsonpath.unknown.function"
groupBundle="messages.JsonBundle" groupKey="json.inspection.group"
level="WARNING" enabledByDefault="true"/>
<localInspection language="JSONPath" shortName="JsonPathUnknownOperator"
implementationClass="com.intellij.jsonpath.inspections.JsonPathUnknownOperatorInspection"
bundle="messages.JsonBundle" key="inspection.jsonpath.unknown.operator"
groupBundle="messages.JsonBundle" groupKey="json.inspection.group"
level="WARNING" enabledByDefault="true"/>
<localInspection language="JSONPath" shortName="JsonPathEvaluateUnknownKey"
implementationClass="com.intellij.jsonpath.inspections.JsonPathEvaluateUnknownKeyInspection"
bundle="messages.JsonBundle" key="inspection.jsonpath.unknown.key"
groupBundle="messages.JsonBundle" groupKey="json.inspection.group"
level="WARNING" enabledByDefault="true"/>

<toolWindowAllowlist id="JSONPathEvaluate"/>

<intentionAction>
<language>JSONPath</language>
<className>com.intellij.jsonpath.ui.JsonPathEvaluateIntentionAction</className>
<bundleName>messages.JsonBundle</bundleName>
<categoryKey>json.intention.category.name</categoryKey>
</intentionAction>
</extensions>

<extensions defaultExtensionNs="JavaScript">
Expand Down
46 changes: 0 additions & 46 deletions json/resources/messages/JsonBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ inspection.duplicate.keys.msg.duplicate.keys=Object contains duplicate keys ''{0
inspection.jsonpath.unknown.function=Unknown JSONPath function
inspection.jsonpath.unknown.operator=Unknown JSONPath operator
inspection.jsonpath.unknown.key=Unknown property key used for JSONPath evaluate expression
inspection.message.jsonpath.unknown.function.name=Unknown function name ''{0}''
inspection.message.jsonpath.unknown.operator.name=Unknown operator ''{0}''
inspection.message.jsonpath.unknown.key=Property key ''{0}'' is not defined in the source JSON document
inspection.message.jsonpath.unsupported.jayway.function=Function {0} is not supported in Jayway JSONPath implementation
inspection.message.jsonpath.unsupported.jayway.operator=Operator {0} is not supported in Jayway JSONPath implementation

# Formatter
formatter.align.properties.caption=Align
Expand Down Expand Up @@ -80,7 +75,6 @@ json.schema.ref.no.array.element=Array doesn''t contain element with index ''{0}
json.schema.ref.no.property=Property ''{0}'' not found

settings.display.name.json=JSON
settings.display.name.jsonpath=JSONPath

settings.json.schema.add.mapping=Add mapping
settings.json.schema.edit.mapping=Edit mapping
Expand Down Expand Up @@ -144,46 +138,6 @@ color.page.attribute.invalid.escape.sequence=Invalid escape sequence
color.page.attribute.valid.escape.sequence=Valid escape sequence
color.page.attribute.parameter=Parameter

jsonpath.color.page.keyword=Keyword
jsonpath.color.page.identifier=Identifier
jsonpath.color.page.string=String
jsonpath.color.page.number=Number
jsonpath.color.page.boolean=Boolean
jsonpath.color.page.function=Function call
jsonpath.color.page.context=Context variable
jsonpath.color.page.brackets=Braces and Operators//Brackets
jsonpath.color.page.braces=Braces and Operators//Braces
jsonpath.color.page.colon=Braces and Operators//Colon
jsonpath.color.page.comma=Braces and Operators//Comma
jsonpath.color.page.dot=Braces and Operators//Dot
jsonpath.color.page.operation.sign=Braces and Operators//Operation sign
jsonpath.color.page.parentheses=Braces and Operators//Parentheses

jsonpath.completion.key=key
jsonpath.evaluate.no.result=Evaluate expression to see result
jsonpath.toolwindow.evaluate.stripe=Evaluate JSONPath
jsonpath.toolwindow.evaluate.on.snippet=Snippet
jsonpath.toolwindow.evaluate.on.snippet.n=Snippet ({0})
jsonpath.toolwindow.evaluate.on.file=File {0}
jsonpath.evaluate.intention=Evaluate JSONPath Expression
jsonpath.evaluate.export.result=Export Result of JSONPath Evaluate
jsonpath.evaluate.progress.export.result=Exporting JSONPath evaluate result

jsonpath.evaluate.add.tab.text=New Tab
jsonpath.evaluate.input=JSON input:
jsonpath.evaluate.result=Result:

jsonpath.evaluate.options=Options
jsonpath.evaluate.output.option=Output:
jsonpath.evaluate.output.values=Matching Values
jsonpath.evaluate.output.paths=Path Expressions

jsonpath.evaluate.suppress.exceptions=Suppress Exceptions During Evaluate
jsonpath.evaluate.return.list=Always Return Result List
jsonpath.evaluate.nullize.missing.leaf=Return Null for Missing Leaf
jsonpath.evaluate.require.all.properties=Require All Properties
jsonpath.evaluate.file.not.found=Input file not found

qualified.name.qualified=qualified name
qualified.name.pointer=JSON pointer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ object CommunityRepositoryModules {
plugin("intellij.vcs.svn") { spec ->
spec.withProjectLibrary("sqlite")
},
plugin("intellij.jsonpath"),
plugin("intellij.xpath") { spec ->
spec.withModule("intellij.xpath.rt", "rt/xslt-rt.jar")
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2466,9 +2466,6 @@ action.Graph.ZoomIn.text=Zoom In
action.JsonCopyPointer.text=Copy JSON Pointer
action.JsonCopyPointer.description=Copy JSON Pointer

action.JsonPathEvaluateAction.text=Evaluate JSONPath Expression...
action.JsonPathExportEvaluateResultAction.text=Export Result

action.ExternalSystem.RemoveRunConfiguration.text=Remove Run Configuration
action.ExternalSystem.EditRunConfiguration.text=Edit Run Configuration...
action.ExternalSystem.ShowIgnored.text=Show Ignored
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions plugins/jsonpath/intellij.jsonpath.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="library" name="jsonpath" level="project" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="module" module-name="intellij.json" />
<orderEntry type="module" module-name="intellij.platform.ide" />
<orderEntry type="module" module-name="intellij.platform.util.ui" />
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
<orderEntry type="module" module-name="intellij.spellchecker" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.structuralSearch" scope="RUNTIME" />
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.langInjection" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.testExtensions" scope="TEST" />
</component>
</module>
64 changes: 64 additions & 0 deletions plugins/jsonpath/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<idea-plugin package="com.intellij.jsonpath">
<id>com.intellij.jsonpath</id>
<name>JSONPath</name>
<vendor>JetBrains</vendor>
<category>JavaScript Frameworks and Tools</category>
<description><![CDATA[
<p>Provides JSONPath language for injected code fragments and dedicated Evaluate JSONPath tool window.</p>
<p>Go to menu <b>Edit - Find - Evaluate JSONPath Expression...</b> to to evaluate expressions with a snippet or JSON file.</p>
]]></description>

<dependencies>
<plugin id="com.intellij.modules.json"/>
</dependencies>

<resource-bundle>messages.JsonPathBundle</resource-bundle>

<extensions defaultExtensionNs="com.intellij">
<lang.parserDefinition language="JSONPath" implementationClass="com.intellij.jsonpath.psi.JsonPathParserDefinition"/>
<lang.braceMatcher language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathPairedBraceMatcher"/>
<lang.quoteHandler language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathQuoteHandler"/>
<lang.syntaxHighlighterFactory language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathSyntaxHighlighterFactory"/>
<annotator language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathFunctionCallAnnotator"/>
<colorSettingsPage implementation="com.intellij.jsonpath.JsonPathColorSettingsPage"/>
<completion.contributor language="JSONPath" order="last" implementationClass="com.intellij.jsonpath.JsonPathCompletionContributor"/>
<spellchecker.support language="JSONPath" implementationClass="com.intellij.jsonpath.JsonPathSpellcheckerStrategy"/>

<localInspection language="JSONPath" shortName="JsonPathUnknownFunction"
implementationClass="com.intellij.jsonpath.inspections.JsonPathUnknownFunctionInspection"
bundle="messages.JsonBundle" key="inspection.jsonpath.unknown.function"
groupBundle="messages.JsonBundle" groupKey="json.inspection.group"
level="WARNING" enabledByDefault="true"/>
<localInspection language="JSONPath" shortName="JsonPathUnknownOperator"
implementationClass="com.intellij.jsonpath.inspections.JsonPathUnknownOperatorInspection"
bundle="messages.JsonBundle" key="inspection.jsonpath.unknown.operator"
groupBundle="messages.JsonBundle" groupKey="json.inspection.group"
level="WARNING" enabledByDefault="true"/>
<localInspection language="JSONPath" shortName="JsonPathEvaluateUnknownKey"
implementationClass="com.intellij.jsonpath.inspections.JsonPathEvaluateUnknownKeyInspection"
bundle="messages.JsonBundle" key="inspection.jsonpath.unknown.key"
groupBundle="messages.JsonBundle" groupKey="json.inspection.group"
level="WARNING" enabledByDefault="true"/>

<toolWindowAllowlist id="JSONPathEvaluate"/>

<intentionAction>
<language>JSONPath</language>
<className>com.intellij.jsonpath.ui.JsonPathEvaluateIntentionAction</className>
<bundleName>messages.JsonBundle</bundleName>
<categoryKey>json.intention.category.name</categoryKey>
</intentionAction>
</extensions>

<actions>
<action id="JsonPathEvaluateAction" class="com.intellij.jsonpath.ui.JsonPathEvaluateAction" icon="AllIcons.FileTypes.Json">
<add-to-group group-id="FindMenuGroup" anchor="after" relative-to-action="StructuralSearchActions"/>
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
</action>

<action id="JsonPathExportEvaluateResultAction" class="com.intellij.jsonpath.ui.JsonPathExportEvaluateResultAction"
use-shortcut-of="ExportToTextFile" icon="AllIcons.Actions.MenuSaveall">
<add-to-group group-id="EditorContextBarMenu"/>
</action>
</actions>
</idea-plugin>
50 changes: 50 additions & 0 deletions plugins/jsonpath/resources/messages/JsonPathBundle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
settings.display.name.jsonpath=JSONPath

jsonpath.color.page.keyword=Keyword
jsonpath.color.page.identifier=Identifier
jsonpath.color.page.string=String
jsonpath.color.page.number=Number
jsonpath.color.page.boolean=Boolean
jsonpath.color.page.function=Function call
jsonpath.color.page.context=Context variable
jsonpath.color.page.brackets=Braces and Operators//Brackets
jsonpath.color.page.braces=Braces and Operators//Braces
jsonpath.color.page.colon=Braces and Operators//Colon
jsonpath.color.page.comma=Braces and Operators//Comma
jsonpath.color.page.dot=Braces and Operators//Dot
jsonpath.color.page.operation.sign=Braces and Operators//Operation sign
jsonpath.color.page.parentheses=Braces and Operators//Parentheses

jsonpath.completion.key=key
jsonpath.evaluate.no.result=Evaluate expression to see result
jsonpath.toolwindow.evaluate.stripe=Evaluate JSONPath
jsonpath.toolwindow.evaluate.on.snippet=Snippet
jsonpath.toolwindow.evaluate.on.snippet.n=Snippet ({0})
jsonpath.toolwindow.evaluate.on.file=File {0}
jsonpath.evaluate.intention=Evaluate JSONPath Expression
jsonpath.evaluate.export.result=Export Result of JSONPath Evaluate
jsonpath.evaluate.progress.export.result=Exporting JSONPath Evaluate Result

jsonpath.evaluate.add.tab.text=New Tab
jsonpath.evaluate.input=JSON input:
jsonpath.evaluate.result=Result:

jsonpath.evaluate.options=Options
jsonpath.evaluate.output.option=Output:
jsonpath.evaluate.output.values=Matching Values
jsonpath.evaluate.output.paths=Path Expressions

jsonpath.evaluate.suppress.exceptions=Suppress Exceptions During Evaluate
jsonpath.evaluate.return.list=Always Return Result List
jsonpath.evaluate.nullize.missing.leaf=Return Null for Missing Leaf
jsonpath.evaluate.require.all.properties=Require All Properties
jsonpath.evaluate.file.not.found=Input file not found

inspection.message.jsonpath.unknown.function.name=Unknown function name ''{0}''
inspection.message.jsonpath.unknown.operator.name=Unknown operator ''{0}''
inspection.message.jsonpath.unknown.key=Property key ''{0}'' is not defined in the source JSON document
inspection.message.jsonpath.unsupported.jayway.function=Function {0} is not supported in Jayway JSONPath implementation
inspection.message.jsonpath.unsupported.jayway.operator=Operator {0} is not supported in Jayway JSONPath implementation

action.JsonPathEvaluateAction.text=Evaluate JSONPath Expression...
action.JsonPathExportEvaluateResultAction.text=Export Result
26 changes: 26 additions & 0 deletions plugins/jsonpath/src/com/intellij/jsonpath/JsonPathBundle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.jsonpath;

import com.intellij.DynamicBundle;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;

import java.util.function.Supplier;

public final class JsonPathBundle {
public static final @NonNls String BUNDLE = "messages.JsonPathBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JsonPathBundle.class, BUNDLE);

private JsonPathBundle() {
}

public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}

public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

0 comments on commit 09003c4

Please sign in to comment.