Merge branch 'IJSDK-479A'

# Conflicts:
#	.idea/gradle.xml
This commit is contained in:
JohnHake 2020-02-10 09:27:03 -08:00
commit 02a45c7b66
89 changed files with 1133 additions and 1182 deletions

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="IntelliJ IDEA IU-171.4073.35" project-jdk-type="IDEA JDK">
<output url="file://build" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/simple_language_plugin.iml" filepath="$PROJECT_DIR$/.idea/simple_language_plugin.iml" />
</modules>
</component>
</project>

View File

@ -1,12 +0,0 @@
<?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$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,495 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="cfe387cf-a053-48a5-8f86-a28a9b3c09ce" name="Default" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="Simple.bnf" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/Simple.bnf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="49" lean-forward="false" selection-start-line="10" selection-start-column="49" selection-end-line="10" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SimpleProperty.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/gen/com/simpleplugin/psi/SimpleProperty.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="8" column="17" lean-forward="false" selection-start-line="8" selection-start-column="17" selection-end-line="8" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SimpleUtil.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/SimpleUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="38" column="30" lean-forward="false" selection-start-line="38" selection-start-column="30" selection-end-line="38" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SimplePsiImplUtil.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/psi/impl/SimplePsiImplUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="381">
<caret line="36" column="15" lean-forward="false" selection-start-line="36" selection-start-column="15" selection-end-line="36" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="GradleLocalSettings">
<option name="modificationStamps">
<map>
<entry key="$USER_HOME$/Foo/kotlin-koans" value="1484925462000" />
<entry key="$USER_HOME$/IdeaProjects/gradle-intellij-plugin" value="2978286332000" />
</map>
</option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="83" />
<option name="y" value="73" />
<option name="width" value="1144" />
<option name="height" value="842" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="gen" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="gen" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="gen" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
<item name="parser" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="gen" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
<item name="psi" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="gen" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
<item name="psi" type="462c0819:PsiDirectoryNode" />
<item name="impl" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
<item name="psi" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="simple_language_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="simple_language_plugin" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="simpleplugin" type="462c0819:PsiDirectoryNode" />
<item name="psi" type="462c0819:PsiDirectoryNode" />
<item name="impl" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="Scratches" />
<pane id="AndroidView" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="nodejs_interpreter_path" value="/usr/local/bin/node" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.17125" />
<property name="project.structure.side.proportion" value="0.0" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="Applet" factoryName="Applet">
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="cfe387cf-a053-48a5-8f86-a28a9b3c09ce" name="Default" comment="" />
<created>1507300015770</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1507300015770</updated>
<workItem from="1507300017018" duration="795000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="795000" />
</component>
<component name="ToolWindowManager">
<frame x="83" y="73" width="1144" height="842" extended-state="0" />
<layout>
<window_info id="Key Promoter X" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32931727" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32931727" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32931727" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24954627" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/gen/com/simpleplugin/parser/SimpleParser.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen/com/simpleplugin/psi/SimpleTypes.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen/com/simpleplugin/psi/SimpleVisitor.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/Simple.flex">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/SimpleLexer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="22" column="0" lean-forward="true" selection-start-line="22" selection-start-column="0" selection-end-line="22" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/Simple.bnf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="49" lean-forward="false" selection-start-line="10" selection-start-column="49" selection-end-line="10" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen/com/simpleplugin/psi/SimpleProperty.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="8" column="17" lean-forward="false" selection-start-line="8" selection-start-column="17" selection-end-line="8" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/SimpleUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="38" column="30" lean-forward="false" selection-start-line="38" selection-start-column="30" selection-end-line="38" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/simpleplugin/psi/impl/SimplePsiImplUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="381">
<caret line="36" column="15" lean-forward="false" selection-start-line="36" selection-start-column="15" selection-end-line="36" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<last-edited>JFlex &amp; idea-flex.skeleton</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>simple_language_plugin</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -0,0 +1,37 @@
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.4.16'
}
group 'com.intellij.sdk'
version '2.0.0'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
test {
// This path value is machine-specific placeholder text.
// Set idea.home.path to the absolute path to the intellij-community source
// on your local machine.
systemProperty "idea.home.path", "/Users/jhake/Documents/source/comm"
}
// Include the generated files in the source set
sourceSets.main.java.srcDirs 'src/main/gen'
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version '2019.3.2'
plugins 'java'
updateSinceUntilBuild = false
}
patchPluginXml {
version = project.version
}

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

183
simple_language_plugin/gradlew vendored Executable file
View File

@ -0,0 +1,183 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

100
simple_language_plugin/gradlew.bat vendored Normal file
View File

@ -0,0 +1,100 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,37 +0,0 @@
<idea-plugin>
<id>com.simpleplugin.unique.plugin.id</id>
<name>Simple Language</name>
<version>1.0</version>
<vendor>JetBrains</vendor>
<description><![CDATA[Simple language plugin for
<a href="http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support_tutorial.html">Custom Language Support Tutorial</a>]]></description>
<idea-version since-build="183.3283.2"/>
<!-- Product and plugin compatibility requirements -->
<depends>com.intellij.modules.java</depends>
<extensions defaultExtensionNs="com.intellij">
<fileTypeFactory implementation="com.simpleplugin.SimpleFileTypeFactory"/>
<lang.parserDefinition language="Simple" implementationClass="com.simpleplugin.SimpleParserDefinition"/>
<lang.syntaxHighlighterFactory key="Simple"
language="Simple"
implementationClass="com.simpleplugin.SimpleSyntaxHighlighterFactory"/>
<colorSettingsPage implementation="com.simpleplugin.SimpleColorSettingsPage"/>
<annotator language="JAVA" implementationClass="com.simpleplugin.SimpleAnnotator"/>
<codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.simpleplugin.SimpleLineMarkerProvider"/>
<completion.contributor language="Simple" implementationClass="com.simpleplugin.SimpleCompletionContributor"/>
<psi.referenceContributor implementation="com.simpleplugin.SimpleReferenceContributor"/>
<lang.findUsagesProvider language="Simple" implementationClass="com.simpleplugin.SimpleFindUsagesProvider"/>
<lang.refactoringSupport language="Simple" implementationClass="com.simpleplugin.SimpleRefactoringSupportProvider"/>
<lang.foldingBuilder language="JAVA" implementationClass="com.simpleplugin.SimpleFoldingBuilder"/>
<gotoSymbolContributor implementation="com.simpleplugin.SimpleChooseByNameContributor"/>
<lang.psiStructureViewFactory language="Simple" implementationClass="com.simpleplugin.SimpleStructureViewFactory"/>
<lang.formatter language="Simple" implementationClass="com.simpleplugin.SimpleFormattingModelBuilder"/>
<codeStyleSettingsProvider implementation="com.simpleplugin.SimpleCodeStyleSettingsProvider"/>
<langCodeStyleSettingsProvider implementation="com.simpleplugin.SimpleLanguageCodeStyleSettingsProvider"/>
<lang.commenter language="Simple" implementationClass="com.simpleplugin.SimpleCommenter"/>
<todoIndexer filetype="Simple file" implementationClass="com.simpleplugin.SimpleTodoIndexer"/>
</extensions>
</idea-plugin>

View File

@ -0,0 +1,2 @@
rootProject.name = 'simple_language_plugin'

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PLUGIN_MODULE" version="4">
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,28 +0,0 @@
{
parserClass="com.simpleplugin.parser.SimpleParser"
extends="com.intellij.extapi.psi.ASTWrapperPsiElement"
psiClassPrefix="Simple"
psiImplClassSuffix="Impl"
psiPackage="com.simpleplugin.psi"
psiImplPackage="com.simpleplugin.psi.impl"
elementTypeHolderClass="com.simpleplugin.psi.SimpleTypes"
elementTypeClass="com.simpleplugin.psi.SimpleElementType"
tokenTypeClass="com.simpleplugin.psi.SimpleTokenType"
psiImplUtilClass="com.simpleplugin.psi.impl.SimplePsiImplUtil"
}
simpleFile ::= (property|COMMENT)*
property ::= (KEY SEPARATOR VALUE?)|KEY {
pin=3
recoverWhile="recover_property"
mixin="com.simpleplugin.psi.impl.SimpleNamedElementImpl"
implements="com.simpleplugin.psi.SimpleNamedElement"
methods=[getKey getValue getName setName getNameIdentifier getPresentation]
}
private recover_property ::= !(KEY|SEPARATOR|COMMENT)

View File

@ -1,37 +0,0 @@
package com.simpleplugin;
import com.intellij.lang.annotation.*;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.simpleplugin.psi.SimpleProperty;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class SimpleAnnotator implements Annotator {
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
if (element instanceof PsiLiteralExpression) {
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
if (value != null && value.startsWith("simple" + ":")) {
Project project = element.getProject();
String key = value.substring(7);
List<SimpleProperty> properties = SimpleUtil.findProperties(project, key);
if (properties.size() == 1) {
TextRange range = new TextRange(element.getTextRange().getStartOffset() + 8,
element.getTextRange().getEndOffset() - 1);
Annotation annotation = holder.createInfoAnnotation(range, null);
annotation.setTextAttributes(DefaultLanguageHighlighterColors.LINE_COMMENT);
} else if (properties.size() == 0) {
TextRange range = new TextRange(element.getTextRange().getStartOffset() + 8,
element.getTextRange().getEndOffset() - 1);
holder.createErrorAnnotation(range, "Unresolved property");
}
}
}
}
}

View File

@ -1,23 +0,0 @@
package com.simpleplugin;
import com.intellij.codeInsight.completion.*;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.util.ProcessingContext;
import com.simpleplugin.psi.SimpleTypes;
import org.jetbrains.annotations.NotNull;
public class SimpleCompletionContributor extends CompletionContributor {
public SimpleCompletionContributor() {
extend(CompletionType.BASIC,
PlatformPatterns.psiElement(SimpleTypes.VALUE).withLanguage(SimpleLanguage.INSTANCE),
new CompletionProvider<CompletionParameters>() {
public void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet resultSet) {
resultSet.addElement(LookupElementBuilder.create("Hello"));
}
}
);
}
}

View File

@ -1,11 +0,0 @@
package com.simpleplugin;
import com.intellij.openapi.fileTypes.*;
import org.jetbrains.annotations.NotNull;
public class SimpleFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(SimpleFileType.INSTANCE);
}
}

View File

@ -1,18 +0,0 @@
package com.simpleplugin;
import com.intellij.lexer.Lexer;
import com.intellij.psi.impl.cache.impl.*;
import com.intellij.psi.search.UsageSearchContext;
public class SimpleFilterLexer extends BaseFilterLexer {
public SimpleFilterLexer(final Lexer originalLexer, final OccurrenceConsumer table) {
super(originalLexer, table);
}
@Override
public void advance() {
scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false);
advanceTodoItemCountsInToken();
myDelegate.advance();
}
}

View File

@ -1,62 +0,0 @@
package com.simpleplugin;
import com.intellij.lang.ASTNode;
import com.intellij.lang.folding.*;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.simpleplugin.psi.SimpleProperty;
import org.jetbrains.annotations.*;
import java.util.*;
public class SimpleFoldingBuilder extends FoldingBuilderEx {
@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
FoldingGroup group = FoldingGroup.newGroup("simple");
List<FoldingDescriptor> descriptors = new ArrayList<FoldingDescriptor>();
Collection<PsiLiteralExpression> literalExpressions =
PsiTreeUtil.findChildrenOfType(root, PsiLiteralExpression.class);
for (final PsiLiteralExpression literalExpression : literalExpressions) {
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
if (value != null && value.startsWith("simple:")) {
Project project = literalExpression.getProject();
String key = value.substring(7);
final List<SimpleProperty> properties = SimpleUtil.findProperties(project, key);
if (properties.size() == 1) {
descriptors.add(new FoldingDescriptor(literalExpression.getNode(),
new TextRange(literalExpression.getTextRange().getStartOffset() + 1,
literalExpression.getTextRange().getEndOffset() - 1),
group) {
@Nullable
@Override
public String getPlaceholderText() {
// IMPORTANT: keys can come with no values, so a test for null is needed
// IMPORTANT: Convert embedded \n to backslash n, so that the string will look like it has LF embedded
// in it and embedded " to escaped "
String valueOf = properties.get(0).getValue();
return valueOf == null ? "" : valueOf.replaceAll("\n", "\\n").replaceAll("\"", "\\\\\"");
}
});
}
}
}
return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}
@Nullable
@Override
public String getPlaceholderText(@NotNull ASTNode node) {
return "...";
}
@Override
public boolean isCollapsedByDefault(@NotNull ASTNode node) {
return true;
}
}

View File

@ -1,37 +0,0 @@
package com.simpleplugin;
import com.intellij.formatting.*;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.simpleplugin.psi.SimpleTypes;
import org.jetbrains.annotations.*;
public class SimpleFormattingModelBuilder implements FormattingModelBuilder {
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
return FormattingModelProvider
.createFormattingModelForPsiFile(element.getContainingFile(),
new SimpleBlock(element.getNode(),
Wrap.createWrap(WrapType.NONE, false),
Alignment.createAlignment(),
createSpaceBuilder(settings)),
settings);
}
private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
return new SpacingBuilder(settings, SimpleLanguage.INSTANCE)
.around(SimpleTypes.SEPARATOR)
.spaceIf(settings.getCommonSettings(SimpleLanguage.INSTANCE.getID()).SPACE_AROUND_ASSIGNMENT_OPERATORS)
.before(SimpleTypes.PROPERTY)
.none();
}
@Nullable
@Override
public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
return null;
}
}

View File

@ -1,9 +0,0 @@
package com.simpleplugin;
import com.intellij.openapi.util.IconLoader;
import javax.swing.*;
public class SimpleIcons {
public static final Icon FILE = IconLoader.getIcon("/com/simpleplugin/icons/jar-gray.png");
}

View File

@ -1,17 +0,0 @@
package com.simpleplugin;
import com.intellij.lexer.Lexer;
import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
public class SimpleIdIndexer extends LexerBasedIdIndexer {
public static Lexer createIndexingLexer(OccurrenceConsumer consumer) {
return new SimpleFilterLexer(new SimpleLexerAdapter(), consumer);
}
@Override
public Lexer createLexer(final OccurrenceConsumer consumer) {
return createIndexingLexer(consumer);
}
}

View File

@ -1,33 +0,0 @@
package com.simpleplugin;
import com.intellij.codeInsight.daemon.*;
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.java.PsiJavaTokenImpl;
import com.simpleplugin.psi.SimpleProperty;
import org.jetbrains.annotations.NotNull;
import java.util.*;
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
@Override
protected void collectNavigationMarkers(@NotNull PsiElement element,
@NotNull Collection<? super RelatedItemLineMarkerInfo> result) {
if (element instanceof PsiJavaTokenImpl && element.getParent() instanceof PsiLiteralExpression) {
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element.getParent();
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
if (value != null && value.startsWith("simple" + ":")) {
Project project = element.getProject();
final List<SimpleProperty> properties = SimpleUtil.findProperties(project, value.substring(7));
if (properties.size() > 0) {
NavigationGutterIconBuilder<PsiElement> builder =
NavigationGutterIconBuilder.create(SimpleIcons.FILE).
setTargets(properties).
setTooltipText("Navigate to a simple property");
result.add(builder.createLineMarkerInfo(element));
}
}
}
}
}

View File

@ -1,12 +0,0 @@
package com.simpleplugin;
import com.intellij.lang.refactoring.RefactoringSupportProvider;
import com.intellij.psi.PsiElement;
import com.simpleplugin.psi.SimpleProperty;
public class SimpleRefactoringSupportProvider extends RefactoringSupportProvider {
@Override
public boolean isMemberInplaceRenameAvailable(PsiElement element, PsiElement context) {
return element instanceof SimpleProperty;
}
}

View File

@ -1,30 +0,0 @@
package com.simpleplugin;
import com.intellij.openapi.util.TextRange;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.*;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.NotNull;
public class SimpleReferenceContributor extends PsiReferenceContributor {
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
@NotNull ProcessingContext
context) {
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
String value = literalExpression.getValue() instanceof String ?
(String) literalExpression.getValue() : null;
if (value != null && value.startsWith("simple" + ":")) {
return new PsiReference[]{
new SimpleReference(element, new TextRange(8, value.length() + 1))};
}
return PsiReference.EMPTY_ARRAY;
}
});
}
}

View File

@ -1,12 +0,0 @@
package com.simpleplugin;
import com.intellij.lexer.Lexer;
import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
import com.intellij.psi.impl.cache.impl.todo.LexerBasedTodoIndexer;
public class SimpleTodoIndexer extends LexerBasedTodoIndexer {
@Override
public Lexer createLexer(OccurrenceConsumer consumer) {
return SimpleIdIndexer.createIndexingLexer(consumer);
}
}

View File

@ -1,11 +0,0 @@
package com.simpleplugin.psi;
import com.intellij.psi.tree.IElementType;
import com.simpleplugin.SimpleLanguage;
import org.jetbrains.annotations.*;
public class SimpleElementType extends IElementType {
public SimpleElementType(@NotNull @NonNls String debugName) {
super(debugName, SimpleLanguage.INSTANCE);
}
}

View File

@ -1,6 +0,0 @@
package com.simpleplugin.psi;
import com.intellij.psi.PsiNameIdentifierOwner;
public interface SimpleNamedElement extends PsiNameIdentifierOwner {
}

View File

@ -1,16 +1,16 @@
/* The following code was generated by JFlex 1.7.0-SNAPSHOT tweaked for IntelliJ platform */
/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import com.simpleplugin.psi.SimpleTypes;
import com.intellij.sdk.language.psi.SimpleTypes;
import com.intellij.psi.TokenType;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.7.0-SNAPSHOT
* <a href="http://www.jflex.de/">JFlex</a> 1.7.0
* from the specification file <tt>Simple.flex</tt>
*/
class SimpleLexer implements FlexLexer {
@ -284,7 +284,7 @@ class SimpleLexer implements FlexLexer {
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
* @return {@code false}, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
@ -320,7 +320,7 @@ class SimpleLexer implements FlexLexer {
/**
* Returns the character at position <tt>pos</tt> from the
* Returns the character at position {@code pos} from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
@ -344,7 +344,7 @@ class SimpleLexer implements FlexLexer {
/**
* Reports an error that occured while scanning.
* Reports an error that occurred while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
@ -492,30 +492,37 @@ class SimpleLexer implements FlexLexer {
case 1:
{ yybegin(YYINITIAL); return SimpleTypes.KEY;
}
// fall through
case 8: break;
case 2:
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
}
// fall through
case 9: break;
case 3:
{ return TokenType.BAD_CHARACTER;
}
// fall through
case 10: break;
case 4:
{ yybegin(YYINITIAL); return SimpleTypes.COMMENT;
}
// fall through
case 11: break;
case 5:
{ yybegin(WAITING_VALUE); return SimpleTypes.SEPARATOR;
}
// fall through
case 12: break;
case 6:
{ yybegin(YYINITIAL); return SimpleTypes.VALUE;
}
// fall through
case 13: break;
case 7:
{ yybegin(WAITING_VALUE); return TokenType.WHITE_SPACE;
}
// fall through
case 14: break;
default:
zzScanError(ZZ_NO_MATCH);

View File

@ -1,9 +1,9 @@
// This is a generated file. Not intended for manual editing.
package com.simpleplugin.parser;
package com.intellij.sdk.language.parser;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import static com.simpleplugin.psi.SimpleTypes.*;
import static com.intellij.sdk.language.psi.SimpleTypes.*;
import static com.intellij.lang.parser.GeneratedParserUtilBase.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.lang.ASTNode;
@ -23,21 +23,33 @@ public class SimpleParser implements PsiParser, LightPsiParser {
boolean r;
b = adapt_builder_(t, b, this, null);
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
if (t == PROPERTY) {
r = property(b, 0);
}
else {
r = parse_root_(t, b, 0);
}
r = parse_root_(t, b);
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
}
protected boolean parse_root_(IElementType t, PsiBuilder b, int l) {
protected boolean parse_root_(IElementType t, PsiBuilder b) {
return parse_root_(t, b, 0);
}
static boolean parse_root_(IElementType t, PsiBuilder b, int l) {
return simpleFile(b, l + 1);
}
/* ********************************************************** */
// (KEY SEPARATOR VALUE?)|KEY
// property|COMMENT|CRLF
static boolean item_(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "item_")) return false;
boolean r;
Marker m = enter_section_(b);
r = property(b, l + 1);
if (!r) r = consumeToken(b, COMMENT);
if (!r) r = consumeToken(b, CRLF);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// (KEY? SEPARATOR VALUE?) | KEY
public static boolean property(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property")) return false;
boolean r;
@ -48,17 +60,25 @@ public class SimpleParser implements PsiParser, LightPsiParser {
return r;
}
// KEY SEPARATOR VALUE?
// KEY? SEPARATOR VALUE?
private static boolean property_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokens(b, 0, KEY, SEPARATOR);
r = property_0_0(b, l + 1);
r = r && consumeToken(b, SEPARATOR);
r = r && property_0_2(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// KEY?
private static boolean property_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property_0_0")) return false;
consumeToken(b, KEY);
return true;
}
// VALUE?
private static boolean property_0_2(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property_0_2")) return false;
@ -81,39 +101,25 @@ public class SimpleParser implements PsiParser, LightPsiParser {
private static boolean recover_property_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "recover_property_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, KEY);
if (!r) r = consumeToken(b, SEPARATOR);
if (!r) r = consumeToken(b, COMMENT);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// (property|COMMENT)*
// item_*
static boolean simpleFile(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "simpleFile")) return false;
int c = current_position_(b);
while (true) {
if (!simpleFile_0(b, l + 1)) break;
int c = current_position_(b);
if (!item_(b, l + 1)) break;
if (!empty_element_parsed_guard_(b, "simpleFile", c)) break;
c = current_position_(b);
}
return true;
}
// property|COMMENT
private static boolean simpleFile_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "simpleFile_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = property(b, l + 1);
if (!r) r = consumeToken(b, COMMENT);
exit_section_(b, m, null, r);
return r;
}
final static Parser recover_property_parser_ = new Parser() {
static final Parser recover_property_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return recover_property(b, l + 1);
}

View File

@ -1,5 +1,5 @@
// This is a generated file. Not intended for manual editing.
package com.simpleplugin.psi;
package com.intellij.sdk.language.psi;
import java.util.List;
import org.jetbrains.annotations.*;

View File

@ -1,16 +1,17 @@
// This is a generated file. Not intended for manual editing.
package com.simpleplugin.psi;
package com.intellij.sdk.language.psi;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.PsiElement;
import com.intellij.lang.ASTNode;
import com.simpleplugin.psi.impl.*;
import com.intellij.sdk.language.psi.impl.*;
public interface SimpleTypes {
IElementType PROPERTY = new SimpleElementType("PROPERTY");
IElementType COMMENT = new SimpleTokenType("COMMENT");
IElementType CRLF = new SimpleTokenType("CRLF");
IElementType KEY = new SimpleTokenType("KEY");
IElementType SEPARATOR = new SimpleTokenType("SEPARATOR");
IElementType VALUE = new SimpleTokenType("VALUE");
@ -18,7 +19,7 @@ public interface SimpleTypes {
class Factory {
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
if (type == PROPERTY) {
if (type == PROPERTY) {
return new SimplePropertyImpl(node);
}
throw new AssertionError("Unknown element type: " + type);

View File

@ -1,5 +1,5 @@
// This is a generated file. Not intended for manual editing.
package com.simpleplugin.psi;
package com.intellij.sdk.language.psi;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElementVisitor;

View File

@ -1,5 +1,5 @@
// This is a generated file. Not intended for manual editing.
package com.simpleplugin.psi.impl;
package com.intellij.sdk.language.psi.impl;
import java.util.List;
import org.jetbrains.annotations.*;
@ -7,13 +7,13 @@ import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static com.simpleplugin.psi.SimpleTypes.*;
import com.simpleplugin.psi.*;
import static com.intellij.sdk.language.psi.SimpleTypes.*;
import com.intellij.sdk.language.psi.*;
import com.intellij.navigation.ItemPresentation;
public class SimplePropertyImpl extends SimpleNamedElementImpl implements SimpleProperty {
public SimplePropertyImpl(ASTNode node) {
public SimplePropertyImpl(@NotNull ASTNode node) {
super(node);
}
@ -26,26 +26,32 @@ public class SimplePropertyImpl extends SimpleNamedElementImpl implements Simple
else super.accept(visitor);
}
@Override
public String getKey() {
return SimplePsiImplUtil.getKey(this);
}
@Override
public String getValue() {
return SimplePsiImplUtil.getValue(this);
}
@Override
public String getName() {
return SimplePsiImplUtil.getName(this);
}
@Override
public PsiElement setName(String newName) {
return SimplePsiImplUtil.setName(this, newName);
}
@Override
public PsiElement getNameIdentifier() {
return SimplePsiImplUtil.getNameIdentifier(this);
}
@Override
public ItemPresentation getPresentation() {
return SimplePsiImplUtil.getPresentation(this);
}

View File

@ -0,0 +1,30 @@
{
parserClass="com.intellij.sdk.language.parser.SimpleParser"
extends="com.intellij.extapi.psi.ASTWrapperPsiElement"
psiClassPrefix="Simple"
psiImplClassSuffix="Impl"
psiPackage="com.intellij.sdk.language.psi"
psiImplPackage="com.intellij.sdk.language.psi.impl"
elementTypeHolderClass="com.intellij.sdk.language.psi.SimpleTypes"
elementTypeClass="com.intellij.sdk.language.psi.SimpleElementType"
tokenTypeClass="com.intellij.sdk.language.psi.SimpleTokenType"
psiImplUtilClass="com.intellij.sdk.language.psi.impl.SimplePsiImplUtil"
}
simpleFile ::= item_*
private item_ ::= (property|COMMENT|CRLF)
property ::= (KEY? SEPARATOR VALUE?) | KEY {
pin=3
recoverWhile="recover_property"
mixin="com.intellij.sdk.language.psi.impl.SimpleNamedElementImpl"
implements="com.intellij.sdk.language.psi.SimpleNamedElement"
methods=[getKey getValue getName setName getNameIdentifier getPresentation]
}
private recover_property ::= !(KEY|SEPARATOR|COMMENT)

View File

@ -1,8 +1,8 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import com.simpleplugin.psi.SimpleTypes;
import com.intellij.sdk.language.psi.SimpleTypes;
import com.intellij.psi.TokenType;
%%

View File

@ -0,0 +1,59 @@
package com.intellij.sdk.language;
import com.intellij.lang.annotation.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import java.util.List;
public class SimpleAnnotator implements Annotator {
// Define strings for the Simple language prefix - used for annotations, line markers, etc.
public static final String SIMPLE_PREFIX_STR = "simple";
public static final String SIMPLE_SEPARATOR_STR = ":";
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
// Ensure the Psi Element is an expression
if (!(element instanceof PsiLiteralExpression)) return;
// Ensure the Psi element contains a string that starts with the key and separator
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
if ((value == null) || !value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR)) return;
// Define the text ranges (start is inclusive, end is exclusive)
// "simple:key"
// 01234567890
TextRange prefixRange = TextRange.from(element.getTextRange().getStartOffset(), SIMPLE_PREFIX_STR.length() + 1);
TextRange separatorRange = TextRange.from(prefixRange.getEndOffset(), SIMPLE_SEPARATOR_STR.length());
TextRange keyRange = new TextRange(separatorRange.getEndOffset(), element.getTextRange().getEndOffset() - 1);
// Get the list of properties from the Project
String possibleProperties = value.substring(SIMPLE_PREFIX_STR.length() + SIMPLE_SEPARATOR_STR.length());
Project project = element.getProject();
List<SimpleProperty> properties = SimpleUtil.findProperties(project, possibleProperties);
// Set the annotations using the text ranges.
Annotation keyAnnotation = holder.createInfoAnnotation(prefixRange, null);
keyAnnotation.setTextAttributes(DefaultLanguageHighlighterColors.KEYWORD);
Annotation separatorAnnotation = holder.createInfoAnnotation(separatorRange, null);
separatorAnnotation.setTextAttributes(SimpleSyntaxHighlighter.SEPARATOR);
if (properties.isEmpty()) {
// No well-formed property found following the key-separator
Annotation badProperty = holder.createErrorAnnotation(keyRange, "Unresolved property");
badProperty.setTextAttributes(SimpleSyntaxHighlighter.BAD_CHARACTER);
// ** Tutorial step 18.3 - Add a quick fix for the string containing possible properties
badProperty.registerFix(new SimpleCreatePropertyQuickFix(possibleProperties));
} else {
// Found at least one property
Annotation annotation = holder.createInfoAnnotation(keyRange, null);
annotation.setTextAttributes(SimpleSyntaxHighlighter.VALUE);
}
}
}

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.formatting.*;
import com.intellij.lang.ASTNode;
@ -23,7 +25,7 @@ public class SimpleBlock extends AbstractBlock {
protected List<Block> buildChildren() {
List<Block> blocks = new ArrayList<Block>();
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
while (child != null) {
if (child.getElementType() != TokenType.WHITE_SPACE) {
Block block = new SimpleBlock(child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(),
spacingBuilder);

View File

@ -1,8 +1,10 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.navigation.*;
import com.intellij.openapi.project.Project;
import com.simpleplugin.psi.SimpleProperty;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@ -24,7 +26,7 @@ public class SimpleChooseByNameContributor implements ChooseByNameContributor {
@NotNull
@Override
public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
// todo include non project items
// TODO: include non project items
List<SimpleProperty> properties = SimpleUtil.findProperties(project, name);
return properties.toArray(new NavigationItem[properties.size()]);
}

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.psi.codeStyle.*;

View File

@ -1,7 +1,8 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.application.options.*;
import com.intellij.openapi.options.Configurable;
import com.intellij.psi.codeStyle.*;
import org.jetbrains.annotations.*;

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
@ -8,12 +8,15 @@ import org.jetbrains.annotations.*;
import javax.swing.*;
import java.util.Map;
import static com.intellij.sdk.language.SimpleLanguage.*;
public class SimpleColorSettingsPage implements ColorSettingsPage {
private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[]{
new AttributesDescriptor("Key", SimpleSyntaxHighlighter.KEY),
new AttributesDescriptor("Separator", SimpleSyntaxHighlighter.SEPARATOR),
new AttributesDescriptor("Value", SimpleSyntaxHighlighter.VALUE),
};
new AttributesDescriptor("Key", SimpleSyntaxHighlighter.KEY),
new AttributesDescriptor("Separator", SimpleSyntaxHighlighter.SEPARATOR),
new AttributesDescriptor("Value", SimpleSyntaxHighlighter.VALUE),
new AttributesDescriptor("Bad Value", SimpleSyntaxHighlighter.BAD_CHARACTER)
};
@Nullable
@Override
@ -31,17 +34,17 @@ public class SimpleColorSettingsPage implements ColorSettingsPage {
@Override
public String getDemoText() {
return "# You are reading the \".properties\" entry.\n" +
"! The exclamation mark can also mark text as comments.\n" +
"website = http://en.wikipedia.org/\n" +
"language = English\n" +
"# The backslash below tells the application to continue reading\n" +
"# the value onto the next line.\n" +
"message = Welcome to \\\n" +
" Wikipedia!\n" +
"# Add spaces to the key\n" +
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
"# Unicode\n" +
"tab : \\u0009";
"! The exclamation mark can also mark text as comments.\n" +
"website = http://en.wikipedia.org/\n" +
"language = English\n" +
"# The backslash below tells the application to continue reading\n" +
"# the value onto the next line.\n" +
"message = Welcome to \\\n" +
" Wikipedia!\n" +
"# Add spaces to the key\n" +
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
"# Unicode\n" +
"tab : \\u0009";
}
@Nullable

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.lang.Commenter;
import org.jetbrains.annotations.Nullable;

View File

@ -0,0 +1,25 @@
// 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.sdk.language;
import com.intellij.codeInsight.completion.*;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.util.ProcessingContext;
import com.intellij.sdk.language.psi.SimpleTypes;
import org.jetbrains.annotations.NotNull;
public class SimpleCompletionContributor extends CompletionContributor {
public SimpleCompletionContributor() {
extend( CompletionType.BASIC,
PlatformPatterns.psiElement(SimpleTypes.VALUE).withLanguage(SimpleLanguage.INSTANCE),
new CompletionProvider<CompletionParameters>() {
public void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet resultSet) {
resultSet.addElement(LookupElementBuilder.create("Hello"));
}
}
);
}
}

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
import com.intellij.lang.ASTNode;
@ -18,18 +20,17 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.search.FileTypeIndex;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.indexing.FileBasedIndex;
import com.simpleplugin.psi.SimpleElementFactory;
import com.simpleplugin.psi.SimpleFile;
import com.simpleplugin.psi.SimpleProperty;
import com.intellij.sdk.language.psi.SimpleElementFactory;
import com.intellij.sdk.language.psi.SimpleFile;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
class CreatePropertyQuickFix extends BaseIntentionAction {
class SimpleCreatePropertyQuickFix extends BaseIntentionAction {
private String key;
CreatePropertyQuickFix(String key) {
SimpleCreatePropertyQuickFix(String key) {
this.key = key;
}
@ -52,17 +53,17 @@ class CreatePropertyQuickFix extends BaseIntentionAction {
@Override
public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws
IncorrectOperationException {
IncorrectOperationException {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
Collection<VirtualFile> virtualFiles =
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project) );
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project) );
if (virtualFiles.size() == 1) {
createProperty(project, virtualFiles.iterator().next());
} else {
final FileChooserDescriptor descriptor =
FileChooserDescriptorFactory.createSingleFileDescriptor(SimpleFileType.INSTANCE);
FileChooserDescriptorFactory.createSingleFileDescriptor(SimpleFileType.INSTANCE);
descriptor.setRoots(ProjectUtil.guessProjectDir(project));
final VirtualFile file = FileChooser.chooseFile(descriptor, project, null);
if (file != null) {

View File

@ -1,7 +1,8 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;

View File

@ -0,0 +1,16 @@
package com.intellij.sdk.language;
import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;
/**
* Note: This class is only used with the fileTypeFactory extension point
* for versions of the IntelliJ Platform prior to v2019.2
*/
public class SimpleFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(SimpleFileType.INSTANCE);
}
}

View File

@ -1,11 +1,14 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.lang.cacheBuilder.*;
import com.intellij.lang.findUsages.FindUsagesProvider;
import com.intellij.psi.*;
import com.intellij.psi.tree.TokenSet;
import com.simpleplugin.psi.*;
import com.intellij.sdk.language.psi.*;
import org.jetbrains.annotations.*;
import static com.intellij.sdk.language.SimpleAnnotator.*;
public class SimpleFindUsagesProvider implements FindUsagesProvider {
@Nullable
@ -52,7 +55,7 @@ public class SimpleFindUsagesProvider implements FindUsagesProvider {
@Override
public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
if (element instanceof SimpleProperty) {
return ((SimpleProperty) element).getKey() + ":" + ((SimpleProperty) element).getValue();
return ((SimpleProperty) element).getKey() + SIMPLE_SEPARATOR_STR + ((SimpleProperty) element).getValue();
} else {
return "";
}

View File

@ -0,0 +1,77 @@
// 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.sdk.language;
import com.intellij.lang.ASTNode;
import com.intellij.lang.folding.*;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.project.*;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.*;
import static com.intellij.sdk.language.SimpleAnnotator.*;
import java.util.*;
public class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {
@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
// Initialize the group of folding regions that will expand/collapse together.
FoldingGroup group = FoldingGroup.newGroup(SIMPLE_PREFIX_STR);
// Initialize the list of folding regions
List< FoldingDescriptor > descriptors = new ArrayList< FoldingDescriptor >();
// Get a collection of the literal expressions in the document below root
Collection< PsiLiteralExpression > literalExpressions =
PsiTreeUtil.findChildrenOfType(root, PsiLiteralExpression.class);
// Evaluate the collection
for ( final PsiLiteralExpression literalExpression : literalExpressions ) {
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
if ( value != null && value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR) ) {
Project project = literalExpression.getProject();
String key = value.substring(SIMPLE_PREFIX_STR.length() + SIMPLE_SEPARATOR_STR.length());
// Get a list of all properties for a given key in the project
final List< SimpleProperty > properties = SimpleUtil.findProperties(project, key);
if ( properties.size() == 1 ) {
// Add a folding descriptor for the literal expression at this node.
descriptors.add(new FoldingDescriptor(literalExpression.getNode(),
new TextRange(literalExpression.getTextRange().getStartOffset() + 1,
literalExpression.getTextRange().getEndOffset() - 1),
group) );
}
}
}
return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}
/**
* Gets the Simple Language 'value' string corresponding to the 'key'
* @param node Node corresponding to PsiLiteralExpression containing a string in the format
* SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR + Key, where Key is
* defined by the Simple language file.
*/
@Nullable
@Override
public String getPlaceholderText(@NotNull ASTNode node) {
String retTxt = "...";
if ( node.getPsi() instanceof PsiLiteralExpression ) {
PsiLiteralExpression nodeElement = (PsiLiteralExpression) node.getPsi();
String key = ((String) nodeElement.getValue()).substring(SIMPLE_PREFIX_STR.length() + SIMPLE_SEPARATOR_STR.length());
final List< SimpleProperty > properties = SimpleUtil.findProperties(nodeElement.getProject(), key);
String place = properties.get(0).getValue();
// IMPORTANT: keys can come with no values, so a test for null is needed
// IMPORTANT: Convert embedded \n to backslash n, so that the string will look
// like it has LF embedded in it and embedded " to escaped "
return place == null ? retTxt : place.replaceAll("\n", "\\n").replaceAll("\"", "\\\\\"");
}
return retTxt;
}
@Override
public boolean isCollapsedByDefault(@NotNull ASTNode node) {
return true;
}
}

View File

@ -0,0 +1,39 @@
// 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.sdk.language;
import com.intellij.formatting.*;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.sdk.language.psi.SimpleTypes;
import org.jetbrains.annotations.*;
public class SimpleFormattingModelBuilder implements FormattingModelBuilder {
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
return FormattingModelProvider
.createFormattingModelForPsiFile(element.getContainingFile(),
new SimpleBlock(element.getNode(),
Wrap.createWrap(WrapType.NONE, false),
Alignment.createAlignment(),
createSpaceBuilder(settings)),
settings);
}
private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
return new SpacingBuilder(settings, SimpleLanguage.INSTANCE)
.around(SimpleTypes.SEPARATOR)
.spaceIf(settings.getCommonSettings(SimpleLanguage.INSTANCE.getID()).SPACE_AROUND_ASSIGNMENT_OPERATORS)
.before(SimpleTypes.PROPERTY)
.none();
}
@Nullable
@Override
public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
return null;
}
}

View File

@ -0,0 +1,9 @@
package com.intellij.sdk.language;
import com.intellij.openapi.util.IconLoader;
import javax.swing.*;
public class SimpleIcons {
public static final Icon FILE = IconLoader.getIcon("/icons/jar-gray.png");
}

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.lang.Language;

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.lang.Language;
import com.intellij.psi.codeStyle.*;
@ -24,19 +26,17 @@ public class SimpleLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSe
@Override
public String getCodeSample(@NotNull SettingsType settingsType) {
return "# You are reading the \".properties\" entry.\n" +
"! The exclamation mark can also mark text as comments.\n" +
"website = http://en.wikipedia.org/\n" +
"\n" +
"\n" +
"\n" +
"language = English\n" +
"# The backslash below tells the application to continue reading\n" +
"# the value onto the next line.\n" +
"message = Welcome to \\\n" +
" Wikipedia!\n" +
"# Add spaces to the key\n" +
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
"# Unicode\n" +
"tab : \\u0009";
"! The exclamation mark can also mark text as comments.\n" +
"website = http://en.wikipedia.org/\n" +
"\n" +
"language = English\n" +
"# The backslash below tells the application to continue reading\n" +
"# the value onto the next line.\n" +
"message = Welcome to \\\n" +
" Wikipedia!\n" +
"# Add spaces to the key\n" +
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
"# Unicode\n" +
"tab : \\u0009";
}
}

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.lexer.FlexAdapter;

View File

@ -0,0 +1,40 @@
package com.intellij.sdk.language;
import com.intellij.codeInsight.daemon.*;
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.java.PsiJavaTokenImpl;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.NotNull;
import static com.intellij.sdk.language.SimpleAnnotator.*;
import java.util.*;
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
@Override
protected void collectNavigationMarkers( @NotNull PsiElement element,
@NotNull Collection< ? super RelatedItemLineMarkerInfo > result ) {
// This must be an element with a literal expression as a parent
if ( !(element instanceof PsiJavaTokenImpl) || !(element.getParent() instanceof PsiLiteralExpression) ) return;
// The literal expression must start with the Simple language literal expression
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element.getParent();
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
if ( ( value == null ) || !value.startsWith( SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR ) ) return;
// Get the Simple language property usage
Project project = element.getProject();
String possibleProperties = value.substring( SIMPLE_PREFIX_STR.length()+SIMPLE_SEPARATOR_STR.length() );
final List< SimpleProperty > properties = SimpleUtil.findProperties( project, possibleProperties );
if ( properties.size() > 0 ) {
// Add the property to a collection of line marker info
NavigationGutterIconBuilder< PsiElement > builder =
NavigationGutterIconBuilder.create( SimpleIcons.FILE )
.setTargets( properties )
.setTooltipText( "Navigate to Simple language property" );
result.add( builder.createLineMarkerInfo( element ) );
}
}
}

View File

@ -1,12 +1,12 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.lang.*;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.tree.*;
import com.simpleplugin.parser.SimpleParser;
import com.simpleplugin.psi.*;
import com.intellij.sdk.language.parser.SimpleParser;
import com.intellij.sdk.language.psi.*;
import org.jetbrains.annotations.NotNull;
public class SimpleParserDefinition implements ParserDefinition {
@ -22,6 +22,7 @@ public class SimpleParserDefinition implements ParserDefinition {
}
@NotNull
@Override
public TokenSet getWhitespaceTokens() {
return WHITE_SPACES;
}

View File

@ -0,0 +1,15 @@
// 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.sdk.language;
import com.intellij.lang.refactoring.RefactoringSupportProvider;
import com.intellij.psi.PsiElement;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.*;
public class SimpleRefactoringSupportProvider extends RefactoringSupportProvider {
@Override
public boolean isMemberInplaceRenameAvailable(@NotNull PsiElement elementToRename, @Nullable PsiElement context) {
return (elementToRename instanceof SimpleProperty);
}
}

View File

@ -1,10 +1,12 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.codeInsight.lookup.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.simpleplugin.psi.SimpleProperty;
import com.intellij.sdk.language.psi.SimpleProperty;
import org.jetbrains.annotations.*;
import java.util.*;
@ -44,9 +46,9 @@ public class SimpleReference extends PsiReferenceBase<PsiElement> implements Psi
List<LookupElement> variants = new ArrayList<LookupElement>();
for (final SimpleProperty property : properties) {
if (property.getKey() != null && property.getKey().length() > 0) {
variants.add(LookupElementBuilder.create(property).
withIcon(SimpleIcons.FILE).
withTypeText(property.getContainingFile().getName())
variants.add(LookupElementBuilder
.create(property).withIcon(SimpleIcons.FILE)
.withTypeText(property.getContainingFile().getName())
);
}
}

View File

@ -0,0 +1,34 @@
// 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.sdk.language;
import com.intellij.openapi.util.TextRange;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.*;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.NotNull;
import static com.intellij.sdk.language.SimpleAnnotator.*;
public class SimpleReferenceContributor extends PsiReferenceContributor {
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
@NotNull ProcessingContext context) {
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
String value = literalExpression.getValue() instanceof String ?
(String) literalExpression.getValue() : null;
if ((value != null && value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR))) {
TextRange property = new TextRange(SIMPLE_PREFIX_STR.length() + SIMPLE_SEPARATOR_STR.length() + 1,
value.length() + 1);
return new PsiReference[]{new SimpleReference(element, property)};
}
return PsiReference.EMPTY_ARRAY;
}
});
}
}

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.structureView.StructureViewTreeElement;
@ -7,66 +9,65 @@ import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.NavigatablePsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.simpleplugin.psi.SimpleFile;
import com.simpleplugin.psi.SimpleProperty;
import com.simpleplugin.psi.impl.SimplePropertyImpl;
import com.intellij.sdk.language.psi.SimpleFile;
import com.intellij.sdk.language.psi.SimpleProperty;
import com.intellij.sdk.language.psi.impl.SimplePropertyImpl;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class SimpleStructureViewElement implements StructureViewTreeElement, SortableTreeElement {
private NavigatablePsiElement element;
private NavigatablePsiElement myElement;
public SimpleStructureViewElement(NavigatablePsiElement element) {
this.element = element;
this.myElement = element;
}
@Override
public Object getValue() {
return element;
return myElement;
}
@Override
public void navigate(boolean requestFocus) {
element.navigate(requestFocus);
myElement.navigate(requestFocus);
}
@Override
public boolean canNavigate() {
return element.canNavigate();
return myElement.canNavigate();
}
@Override
public boolean canNavigateToSource() {
return element.canNavigateToSource();
return myElement.canNavigateToSource();
}
@NotNull
@Override
public String getAlphaSortKey() {
String name = element.getName();
String name = myElement.getName();
return name != null ? name : "";
}
@NotNull
@Override
public ItemPresentation getPresentation() {
ItemPresentation presentation = element.getPresentation();
ItemPresentation presentation = myElement.getPresentation();
return presentation != null ? presentation : new PresentationData();
}
@Override
public TreeElement[] getChildren() {
if (element instanceof SimpleFile) {
SimpleProperty[] properties = PsiTreeUtil.getChildrenOfType(element, SimpleProperty.class);
if (myElement instanceof SimpleFile) {
SimpleProperty[] properties = PsiTreeUtil.getChildrenOfType(myElement, SimpleProperty.class);
List<TreeElement> treeElements = new ArrayList<TreeElement>(properties.length);
for (SimpleProperty property : properties) {
treeElements.add(new SimpleStructureViewElement((SimplePropertyImpl) property));
}
return treeElements.toArray(new TreeElement[treeElements.size()]);
} else {
return EMPTY_ARRAY;
}
return EMPTY_ARRAY;
}
}

View File

@ -1,4 +1,6 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.ide.structureView.*;
import com.intellij.lang.PsiStructureViewFactory;

View File

@ -1,13 +1,15 @@
package com.simpleplugin;
// 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.sdk.language;
import com.intellij.ide.structureView.*;
import com.intellij.ide.util.treeView.smartTree.Sorter;
import com.intellij.psi.PsiFile;
import com.simpleplugin.psi.SimpleFile;
import com.intellij.sdk.language.psi.SimpleFile;
import org.jetbrains.annotations.NotNull;
public class SimpleStructureViewModel extends StructureViewModelBase implements
StructureViewModel.ElementInfoProvider {
StructureViewModel.ElementInfoProvider {
public SimpleStructureViewModel(PsiFile psiFile) {
super(psiFile, new SimpleStructureViewElement(psiFile));
}

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.*;
@ -6,22 +6,23 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import com.simpleplugin.psi.SimpleTypes;
import com.intellij.sdk.language.psi.SimpleTypes;
import org.jetbrains.annotations.NotNull;
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
public class SimpleSyntaxHighlighter extends SyntaxHighlighterBase {
public static final TextAttributesKey SEPARATOR =
createTextAttributesKey("SIMPLE_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN);
createTextAttributesKey("SIMPLE_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN);
public static final TextAttributesKey KEY =
createTextAttributesKey("SIMPLE_KEY", DefaultLanguageHighlighterColors.KEYWORD);
createTextAttributesKey("SIMPLE_KEY", DefaultLanguageHighlighterColors.KEYWORD);
public static final TextAttributesKey VALUE =
createTextAttributesKey("SIMPLE_VALUE", DefaultLanguageHighlighterColors.STRING);
createTextAttributesKey("SIMPLE_VALUE", DefaultLanguageHighlighterColors.STRING);
public static final TextAttributesKey COMMENT =
createTextAttributesKey("SIMPLE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
createTextAttributesKey("SIMPLE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
public static final TextAttributesKey BAD_CHARACTER =
createTextAttributesKey("SIMPLE_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
createTextAttributesKey("SIMPLE_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER};
private static final TextAttributesKey[] SEPARATOR_KEYS = new TextAttributesKey[]{SEPARATOR};

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.openapi.fileTypes.*;
import com.intellij.openapi.project.Project;

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
@ -6,15 +6,17 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.search.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.indexing.FileBasedIndex;
import com.simpleplugin.psi.*;
import com.intellij.sdk.language.psi.*;
import java.util.*;
public class SimpleUtil {
// Searches the entire project for Simple language files with instances of the Simple property with the given key
public static List<SimpleProperty> findProperties(Project project, String key) {
List<SimpleProperty> result = null;
Collection<VirtualFile> virtualFiles =
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
for (VirtualFile virtualFile : virtualFiles) {
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
if (simpleFile != null) {
@ -37,7 +39,7 @@ public class SimpleUtil {
public static List<SimpleProperty> findProperties(Project project) {
List<SimpleProperty> result = new ArrayList<SimpleProperty>();
Collection<VirtualFile> virtualFiles =
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
for (VirtualFile virtualFile : virtualFiles) {
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
if (simpleFile != null) {

View File

@ -1,17 +1,19 @@
package com.simpleplugin.psi;
// 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.sdk.language.psi;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.simpleplugin.SimpleFileType;
import com.intellij.sdk.language.SimpleFileType;
public class SimpleElementFactory {
public static SimpleProperty createProperty(Project project, String name, String value) {
final SimpleFile file = createFile(project, name + " = " + value);
public static SimpleProperty createProperty(Project project, String name) {
final SimpleFile file = createFile(project, name);
return (SimpleProperty) file.getFirstChild();
}
public static SimpleProperty createProperty(Project project, String name) {
final SimpleFile file = createFile(project, name);
public static SimpleProperty createProperty(Project project, String name, String value) {
final SimpleFile file = createFile(project, name + " = " + value);
return (SimpleProperty) file.getFirstChild();
}
@ -22,7 +24,6 @@ public class SimpleElementFactory {
public static SimpleFile createFile(Project project, String text) {
String name = "dummy.simple";
return (SimpleFile) PsiFileFactory.getInstance(project).
createFileFromText(name, SimpleFileType.INSTANCE, text);
return (SimpleFile) PsiFileFactory.getInstance( project).createFileFromText(name, SimpleFileType.INSTANCE, text);
}
}

View File

@ -0,0 +1,12 @@
package com.intellij.sdk.language.psi;
import com.intellij.psi.tree.IElementType;
import com.intellij.sdk.language.SimpleLanguage;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class SimpleElementType extends IElementType {
public SimpleElementType( @NotNull @NonNls String debugName) {
super(debugName, SimpleLanguage.INSTANCE);
}
}

View File

@ -1,9 +1,9 @@
package com.simpleplugin.psi;
package com.intellij.sdk.language.psi;
import com.intellij.extapi.psi.PsiFileBase;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.psi.FileViewProvider;
import com.simpleplugin.*;
import com.intellij.sdk.language.*;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@ -23,9 +23,4 @@ public class SimpleFile extends PsiFileBase {
public String toString() {
return "Simple File";
}
@Override
public Icon getIcon(int flags) {
return super.getIcon(flags);
}
}

View File

@ -0,0 +1,8 @@
// 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.sdk.language.psi;
import com.intellij.psi.PsiNameIdentifierOwner;
public interface SimpleNamedElement extends PsiNameIdentifierOwner {
}

View File

@ -1,7 +1,7 @@
package com.simpleplugin.psi;
package com.intellij.sdk.language.psi;
import com.intellij.psi.tree.IElementType;
import com.simpleplugin.SimpleLanguage;
import com.intellij.sdk.language.SimpleLanguage;
import org.jetbrains.annotations.*;
public class SimpleTokenType extends IElementType {

View File

@ -1,8 +1,10 @@
package com.simpleplugin.psi.impl;
// 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.sdk.language.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.simpleplugin.psi.SimpleNamedElement;
import com.intellij.sdk.language.psi.SimpleNamedElement;
import org.jetbrains.annotations.NotNull;
public abstract class SimpleNamedElementImpl extends ASTWrapperPsiElement implements SimpleNamedElement {

View File

@ -1,10 +1,11 @@
package com.simpleplugin.psi.impl;
package com.intellij.sdk.language.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.*;
import com.simpleplugin.SimpleIcons;
import com.simpleplugin.psi.*;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.sdk.language.SimpleIcons;
import com.intellij.sdk.language.psi.*;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@ -43,7 +44,7 @@ public class SimplePsiImplUtil {
return element;
}
public static PsiElement getNameIdentifier(SimpleProperty element) {
public static PsiElement getNameIdentifier( SimpleProperty element) {
ASTNode keyNode = element.getNode().findChildByType(SimpleTypes.KEY);
if (keyNode != null) {
return keyNode.getPsi();
@ -52,7 +53,7 @@ public class SimplePsiImplUtil {
}
}
public static ItemPresentation getPresentation(final SimpleProperty element) {
public static ItemPresentation getPresentation( final SimpleProperty element) {
return new ItemPresentation() {
@Nullable
@Override
@ -69,9 +70,10 @@ public class SimplePsiImplUtil {
@Nullable
@Override
public Icon getIcon(boolean unused) {
public Icon getIcon( boolean unused) {
return SimpleIcons.FILE;
}
};
}
}

View File

@ -0,0 +1,67 @@
<!-- 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. -->
<idea-plugin>
<!-- Unique id for this plugin. Must stay constant for the life of the plugin. -->
<id>com.intellij.sdk.simple_language</id>
<!-- Text to display as name on Preferences/Settings | Plugin page -->
<name>SDK: Simple Language Sample Project</name>
<!-- The version of this plugin -->
<version>2.0.0</version>
<!-- Compatible with the following versions of IntelliJ Platform
At least 2019.2 is required. Otherwise, FileTypeFactor must be registered as an extension.
See the extensions section below. -->
<idea-version since-build="192.2"/>
<!-- Product and plugin compatibility requirements -->
<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.java</depends>
<!-- Text to display as description on Preferences/Settings | Plugin page -->
<description>
<![CDATA[
Demonstrates how to add custom language support to an IntelliJ Platform-based IDE. <br>Defines a new language, <i>Simple language</i> with support for syntax highlighting, annotations, code completion, and other features.
<br>See the <a href="https://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support_tutorial.html">Custom Language Tutorial</a> for more information.
]]>
</description>
<change-notes>
<![CDATA[
<ul>
<li><b>2.0.0</b> Convert to Gradle-based plugin.</li>
<li><b>1.0.0</b> Release 2018.3 and earlier.</li>
</ul>
]]>
</change-notes>
<!-- Text to display as company information on Preferences/Settings | Plugin page -->
<vendor url="https://plugins.jetbrains.com">IntelliJ Platform SDK</vendor>
<extensions defaultExtensionNs="com.intellij">
<fileType name="Simple file" implementationClass="com.intellij.sdk.language.SimpleFileType" fieldName="INSTANCE"
language="Simple" extensions="simple"/>
<!-- Only required for versions of the IntelliJ Platform prior to v2019.2.
Use fileTypeFactory extension point INSTEAD of fileType.
<fileTypeFactory implementation="com.intellij.sdk.language.SimpleFileTypeFactory"/>
-->
<lang.parserDefinition language="Simple" implementationClass="com.intellij.sdk.language.SimpleParserDefinition"/>
<lang.syntaxHighlighterFactory language="Simple" implementationClass="com.intellij.sdk.language.SimpleSyntaxHighlighterFactory"/>
<colorSettingsPage implementation="com.intellij.sdk.language.SimpleColorSettingsPage"/>
<annotator language="JAVA" implementationClass="com.intellij.sdk.language.SimpleAnnotator"/>
<codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.sdk.language.SimpleLineMarkerProvider"/>
<completion.contributor language="Simple" implementationClass="com.intellij.sdk.language.SimpleCompletionContributor"/>
<psi.referenceContributor implementation="com.intellij.sdk.language.SimpleReferenceContributor"/>
<lang.refactoringSupport language="Simple" implementationClass="com.intellij.sdk.language.SimpleRefactoringSupportProvider"/>
<lang.findUsagesProvider language="Simple" implementationClass="com.intellij.sdk.language.SimpleFindUsagesProvider"/>
<lang.foldingBuilder language="JAVA" implementationClass="com.intellij.sdk.language.SimpleFoldingBuilder"/>
<gotoSymbolContributor implementation="com.intellij.sdk.language.SimpleChooseByNameContributor"/>
<lang.psiStructureViewFactory language="Simple" implementationClass="com.intellij.sdk.language.SimpleStructureViewFactory"/>
<lang.formatter language="Simple" implementationClass="com.intellij.sdk.language.SimpleFormattingModelBuilder"/>
<codeStyleSettingsProvider implementation="com.intellij.sdk.language.SimpleCodeStyleSettingsProvider"/>
<langCodeStyleSettingsProvider implementation="com.intellij.sdk.language.SimpleLanguageCodeStyleSettingsProvider"/>
<lang.commenter language="Simple" implementationClass="com.intellij.sdk.language.SimpleCommenter"/>
</extensions>
</idea-plugin>

View File

@ -0,0 +1,58 @@
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="80" viewBox="0 0 81 80">
<defs>
<linearGradient id="pluginsdk_80-a" x1="-.031%" x2="100.053%" y1="49.963%" y2="49.963%">
<stop offset="25.81%" stop-color="#F97A12"/>
<stop offset="45.91%" stop-color="#B07B58"/>
<stop offset="72.41%" stop-color="#577BAE"/>
<stop offset="91.05%" stop-color="#1E7CE5"/>
<stop offset="100%" stop-color="#087CFA"/>
</linearGradient>
<linearGradient id="pluginsdk_80-b" x1="27.55%" x2="82.223%" y1="34.514%" y2="77.605%">
<stop offset="0%" stop-color="#F97A12"/>
<stop offset="7.18%" stop-color="#CB7A3E"/>
<stop offset="15.41%" stop-color="#9E7B6A"/>
<stop offset="24.2%" stop-color="#757B91"/>
<stop offset="33.44%" stop-color="#537BB1"/>
<stop offset="43.24%" stop-color="#387CCC"/>
<stop offset="53.81%" stop-color="#237CE0"/>
<stop offset="65.52%" stop-color="#147CEF"/>
<stop offset="79.25%" stop-color="#0B7CF7"/>
<stop offset="100%" stop-color="#087CFA"/>
</linearGradient>
<linearGradient id="pluginsdk_80-c" x1="63.121%" x2="40.793%" y1="97.699%" y2="-6.587%">
<stop offset="0%" stop-color="#FE315D"/>
<stop offset="7.84%" stop-color="#CB417E"/>
<stop offset="16.01%" stop-color="#9E4E9B"/>
<stop offset="24.74%" stop-color="#755BB4"/>
<stop offset="33.92%" stop-color="#5365CA"/>
<stop offset="43.65%" stop-color="#386DDB"/>
<stop offset="54.14%" stop-color="#2374E9"/>
<stop offset="65.76%" stop-color="#1478F3"/>
<stop offset="79.4%" stop-color="#0B7BF8"/>
<stop offset="100%" stop-color="#087CFA"/>
</linearGradient>
<linearGradient id="pluginsdk_80-d" x1="25.331%" x2="93.854%" y1="24.119%" y2="132.621%">
<stop offset="0%" stop-color="#FE315D"/>
<stop offset="4.023%" stop-color="#F63462"/>
<stop offset="10.37%" stop-color="#DF3A71"/>
<stop offset="16.67%" stop-color="#C24383"/>
<stop offset="29.12%" stop-color="#AD4A91"/>
<stop offset="54.98%" stop-color="#755BB4"/>
<stop offset="91.75%" stop-color="#1D76ED"/>
<stop offset="100%" stop-color="#087CFA"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<g fill-rule="nonzero" transform="translate(8 8)">
<path fill="url(#pluginsdk_80-a)" d="M6.08754566,64 L2.66453526e-15,59.1000946 L0,26.7918961 L30,38.6703369 L10.1403967,64 L6.08754566,64 Z"/>
<path fill="url(#pluginsdk_80-b)" d="M20.9524706,64 L52.2740919,31.9159091 L37.6708832,0.460194805 L38.0580944,1.33226763e-15 L64,0 L64,64 L20.9524706,64 Z"/>
<path fill="url(#pluginsdk_80-c)" d="M34.4123783,0 L64,0 L64,28.0366227 L49.0078336,44 L34,0.44696173 L34.4123783,0 Z"/>
<path fill="url(#pluginsdk_80-d)" d="M30.3358775,64 L0,64 L0,49.9709549 L6.23437817,29.2830519 L0,27.1596093 L0,0 L39.4697238,0 L58,21.3844805 L30.5381317,63.9259091 L30.3358775,64 Z"/>
</g>
<g fill-rule="nonzero" transform="translate(12 12)">
<rect width="56" height="56" fill="#000"/>
<rect width="22" height="4" x="4" y="46" fill="#FFFEFE"/>
<path fill="#FFFEFE" d="M11.128,25.28 C8.584,25.28 6.016,24.392 4,22.592 L6.184,19.976 C7.696,21.224 9.28,22.016 11.2,22.016 C12.712,22.016 13.624,21.416 13.624,20.432 L13.624,20.384 C13.624,19.448 13.048,18.968 10.24,18.248 C6.856,17.384 4.672,16.448 4.672,13.112 L4.672,13.064 C4.672,10.016 7.12,8 10.552,8 C13,8 15.088,8.768 16.792,10.136 L14.872,12.92 C13.384,11.888 11.92,11.264 10.504,11.264 C9.088,11.264 8.344,11.912 8.344,12.728 L8.344,12.776 C8.344,13.88 9.064,14.24 11.968,14.984 C15.376,15.872 17.296,17.096 17.296,20.024 L17.296,20.072 C17.296,23.408 14.752,25.28 11.128,25.28 Z M19.512,25.04 L19.512,8.24 L26.064,8.24 C31.344,8.24 34.992,11.864 34.992,16.592 L34.992,16.64 C34.992,21.368 31.344,25.04 26.064,25.04 L19.512,25.04 Z M26.064,11.576 L23.208,11.576 L23.208,21.704 L26.064,21.704 C29.088,21.704 31.128,19.664 31.128,16.688 L31.128,16.64 C31.128,13.664 29.088,11.576 26.064,11.576 Z M37.28,25.04 L37.28,8.24 L40.976,8.24 L40.976,15.584 L47.744,8.24 L52.28,8.24 L45.416,15.368 L52.568,25.04 L48.128,25.04 L42.92,17.888 L40.976,19.904 L40.976,25.04 L37.28,25.04 Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.application.options.CodeStyle;
import com.intellij.codeInsight.completion.CompletionType;
@ -6,23 +6,25 @@ import com.intellij.codeInsight.generation.actions.CommentByLineCommentAction;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.psi.PsiElement;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.containers.ContainerUtil;
import com.simpleplugin.psi.SimpleProperty;
import com.intellij.sdk.language.psi.SimpleProperty;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class SimpleCodeInsightTest extends LightCodeInsightFixtureTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {
/**
*
* @return path to test data file directory relative to working directory in the run configuration for this test.
*/
@Override
protected String getTestDataPath() { return "testData"; }
protected String getTestDataPath() {
return "src/test/resources";
}
public void testCompletion() {
myFixture.configureByFiles("CompleteTestData.java", "DefaultTestData.simple");

View File

@ -1,4 +1,4 @@
package com.simpleplugin;
package com.intellij.sdk.language;
import com.intellij.testFramework.ParsingTestCase;
@ -11,9 +11,13 @@ public class SimpleParsingTest extends ParsingTestCase {
doTest(true);
}
/**
*
* @return path to test data file directory relative to root of this module.
*/
@Override
protected String getTestDataPath() {
return "testData";
return "src/test/resources";
}
@Override

View File

@ -2,6 +2,6 @@ public class Test {
public static void main(String[] args) {
System.out.println("simple:website");
System.out.println("simple:key with spaces");
System.out.println("simple:<error descr="Unresolved property">websit"</error>);
System.out.println("simple:<error descr="Unresolved property">websit</error>");
}
}