Initial Commit
This commit is contained in:
commit
365bcbbd93
35 changed files with 2203 additions and 0 deletions
145
.gitignore
vendored
Normal file
145
.gitignore
vendored
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,java
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,gradle,java
|
||||||
|
|
||||||
|
### Intellij+all ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
.idea/artifacts
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/*.iml
|
||||||
|
.idea/modules
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# SonarLint plugin
|
||||||
|
.idea/sonarlint/
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### Intellij+all Patch ###
|
||||||
|
# Ignore everything but code style settings and run configurations
|
||||||
|
# that are supposed to be shared within teams.
|
||||||
|
|
||||||
|
.idea/*
|
||||||
|
|
||||||
|
!.idea/codeStyles
|
||||||
|
!.idea/runConfigurations
|
||||||
|
|
||||||
|
### Java ###
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
replay_pid*
|
||||||
|
|
||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
**/build/
|
||||||
|
!src/**/build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Avoid ignore Gradle wrappper properties
|
||||||
|
!gradle-wrapper.properties
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
# Eclipse Gradle plugin generated files
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
### Gradle Patch ###
|
||||||
|
# Java heap dump
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,java
|
89
.idea/codeStyles/Project.xml
generated
Normal file
89
.idea/codeStyles/Project.xml
generated
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JavaCodeStyleSettings>
|
||||||
|
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
|
||||||
|
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
||||||
|
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
|
||||||
|
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
|
||||||
|
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||||
|
<value />
|
||||||
|
</option>
|
||||||
|
<option name="IMPORT_LAYOUT_TABLE">
|
||||||
|
<value>
|
||||||
|
<package name="" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="net.minecraft" withSubpackages="true" static="false" />
|
||||||
|
<package name="net.minecraftforge" withSubpackages="true" static="false" />
|
||||||
|
<package name="cpw" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="javax" withSubpackages="true" static="false" />
|
||||||
|
<package name="java" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="" withSubpackages="true" static="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
||||||
|
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
||||||
|
</JavaCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="Glsl">
|
||||||
|
<option name="SPACE_BEFORE_COLON" value="false" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="JAVA">
|
||||||
|
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||||
|
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||||
|
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||||
|
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
|
||||||
|
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||||
|
<option name="RESOURCE_LIST_WRAP" value="1" />
|
||||||
|
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||||
|
<option name="THROWS_LIST_WRAP" value="1" />
|
||||||
|
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||||
|
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||||
|
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
|
||||||
|
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||||
|
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||||
|
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||||
|
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
|
||||||
|
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||||
|
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||||
|
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||||
|
<option name="ASSERT_STATEMENT_WRAP" value="1" />
|
||||||
|
<option name="ASSERT_STATEMENT_COLON_ON_NEXT_LINE" value="true" />
|
||||||
|
<option name="IF_BRACE_FORCE" value="3" />
|
||||||
|
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||||
|
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||||
|
<option name="FOR_BRACE_FORCE" value="3" />
|
||||||
|
<option name="PARAMETER_ANNOTATION_WRAP" value="1" />
|
||||||
|
<option name="VARIABLE_ANNOTATION_WRAP" value="5" />
|
||||||
|
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
||||||
|
<option name="WRAP_ON_TYPING" value="0" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="JavaScript">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="TypeScript">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
10
CHANGELOG.md
Normal file
10
CHANGELOG.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
|
||||||
|
|
||||||
|
# ZigBrains
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.1.0]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Initial prototype. Lots of important stuff not yet implemented, but basic syntax highlighting and go to definition works.
|
202
LICENSE
Normal file
202
LICENSE
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2023 FalsePattern
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://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.
|
30
README.md
Normal file
30
README.md
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# ZigBrains
|
||||||
|
|
||||||
|
<!-- Plugin description -->
|
||||||
|
Yet another attempt at bringing zig to the intellij world, but this time without fumbling about with the
|
||||||
|
IntellIJ parser/tokenizer.
|
||||||
|
|
||||||
|
Feature tracker:
|
||||||
|
|
||||||
|
- [x] Code completion
|
||||||
|
- [x] Syntax highlighting
|
||||||
|
- [x] Go to definition
|
||||||
|
- [x] Rename symbol
|
||||||
|
- [x] Hover documentation
|
||||||
|
- [ ] Autocomplete
|
||||||
|
(Worked with an older version of ZLS, probably a protocol change, will investigate)
|
||||||
|
- [ ] Go to implementations / find usages
|
||||||
|
(A bit broken without a PSI tree, will need to poke my nose into LSP4IntellIJ internals for this)
|
||||||
|
- [ ] Workspace Symbols
|
||||||
|
(Will add it later, personally I never used this feature yet)
|
||||||
|
<!-- Plugin description end -->
|
||||||
|
|
||||||
|
## Licenses
|
||||||
|
```
|
||||||
|
All code in this project, unless specified differently, is licensed under the Apache 2.0 license.
|
||||||
|
```
|
||||||
|
```
|
||||||
|
The `zig.svg` and `zigbrains.svg` files are derived from the official Zig Programming Language logo,
|
||||||
|
which are property of the Zig Software Foundation. (https://github.com/ziglang/logo).
|
||||||
|
These art assets are licensed under `Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).`
|
||||||
|
```
|
100
build.gradle.kts
Normal file
100
build.gradle.kts
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
import org.jetbrains.changelog.Changelog
|
||||||
|
import org.jetbrains.changelog.markdownToHTML
|
||||||
|
|
||||||
|
fun properties(key: String) = providers.gradleProperty(key)
|
||||||
|
fun environment(key: String) = providers.environmentVariable(key)
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("java") // Java support
|
||||||
|
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
|
||||||
|
alias(libs.plugins.changelog) // Gradle Changelog Plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
group = properties("pluginGroup").get()
|
||||||
|
version = properties("pluginVersion").get()
|
||||||
|
|
||||||
|
// Configure project's dependencies
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
// Personal jitpack mirror with builtin caching, so it's a bit faster than jitpack
|
||||||
|
// If it fails to pull deps, comment it out and uncomment the line below it
|
||||||
|
setUrl("https://mvn.falsepattern.com/jitpack/")
|
||||||
|
// setUrl("https://jitpack.io/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly(libs.annotations)
|
||||||
|
//TODO Switch back to upstream once https://github.com/ballerina-platform/lsp4intellij/pull/331 is merged.
|
||||||
|
implementation("com.github.FalsePattern:lsp4intellij:41c9341dc9")
|
||||||
|
}
|
||||||
|
|
||||||
|
intellij {
|
||||||
|
pluginName = properties("pluginName")
|
||||||
|
version = properties("platformVersion")
|
||||||
|
type = properties("platformType")
|
||||||
|
|
||||||
|
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
|
||||||
|
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
|
||||||
|
}
|
||||||
|
|
||||||
|
changelog {
|
||||||
|
groups.empty()
|
||||||
|
repositoryUrl = properties("pluginRepositoryUrl")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
wrapper {
|
||||||
|
gradleVersion = properties("gradleVersion").get()
|
||||||
|
}
|
||||||
|
|
||||||
|
patchPluginXml {
|
||||||
|
version = properties("pluginVersion")
|
||||||
|
sinceBuild = properties("pluginSinceBuild")
|
||||||
|
untilBuild = properties("pluginUntilBuild")
|
||||||
|
|
||||||
|
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
|
||||||
|
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
|
||||||
|
val start = "<!-- Plugin description -->"
|
||||||
|
val end = "<!-- Plugin description end -->"
|
||||||
|
|
||||||
|
with (it.lines()) {
|
||||||
|
if (!containsAll(listOf(start, end))) {
|
||||||
|
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
|
||||||
|
}
|
||||||
|
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val changelog = project.changelog // local variable for configuration cache compatibility
|
||||||
|
// Get the latest available change notes from the changelog file
|
||||||
|
changeNotes = properties("pluginVersion").map { pluginVersion ->
|
||||||
|
with(changelog) {
|
||||||
|
renderItem(
|
||||||
|
(getOrNull(pluginVersion) ?: getUnreleased())
|
||||||
|
.withHeader(false)
|
||||||
|
.withEmptySections(false),
|
||||||
|
Changelog.OutputType.HTML,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO this whole thing
|
||||||
|
//
|
||||||
|
// signPlugin {
|
||||||
|
// certificateChain = environment("CERTIFICATE_CHAIN")
|
||||||
|
// privateKey = environment("PRIVATE_KEY")
|
||||||
|
// password = environment("PRIVATE_KEY_PASSWORD")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// publishPlugin {
|
||||||
|
// dependsOn("patchChangelog")
|
||||||
|
// token = environment("PUBLISH_TOKEN")
|
||||||
|
// // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
|
||||||
|
// // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
|
||||||
|
// // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
|
||||||
|
// channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
|
||||||
|
// }
|
||||||
|
}
|
29
gradle.properties
Normal file
29
gradle.properties
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
pluginGroup = com.falsepattern.zigbrains
|
||||||
|
pluginName = ZigBrains
|
||||||
|
pluginRepositoryUrl = https://github.com/FalsePattern/ZigBrains
|
||||||
|
# SemVer format -> https://semver.org
|
||||||
|
pluginVersion = 0.1.0
|
||||||
|
|
||||||
|
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||||
|
pluginSinceBuild = 222
|
||||||
|
pluginUntilBuild = 232.*
|
||||||
|
|
||||||
|
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||||
|
platformType = IC
|
||||||
|
platformVersion = 2022.2.5
|
||||||
|
|
||||||
|
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
|
||||||
|
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
|
||||||
|
platformPlugins =
|
||||||
|
|
||||||
|
# Gradle Releases -> https://github.com/gradle/gradle/releases
|
||||||
|
gradleVersion = 8.2.1
|
||||||
|
|
||||||
|
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
|
||||||
|
org.gradle.configuration-cache = true
|
||||||
|
|
||||||
|
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
|
||||||
|
org.gradle.caching = true
|
||||||
|
|
||||||
|
# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
|
||||||
|
systemProp.org.gradle.unsafe.kotlin.assignment = true
|
20
gradle/libs.versions.toml
Normal file
20
gradle/libs.versions.toml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[versions]
|
||||||
|
# libraries
|
||||||
|
annotations = "24.0.1"
|
||||||
|
|
||||||
|
# plugins
|
||||||
|
kotlin = "1.9.0"
|
||||||
|
changelog = "2.1.2"
|
||||||
|
gradleIntelliJPlugin = "1.15.0"
|
||||||
|
qodana = "0.1.13"
|
||||||
|
kover = "0.7.2"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
||||||
|
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
|
||||||
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
|
||||||
|
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
248
gradlew
vendored
Normal file
248
gradlew
vendored
Normal file
|
@ -0,0 +1,248 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# 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 ;; #(
|
||||||
|
MSYS* | 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
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
92
gradlew.bat
vendored
Normal file
92
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
@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=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@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% equ 0 goto execute
|
||||||
|
|
||||||
|
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 execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
: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 %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 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!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
1
settings.gradle.kts
Normal file
1
settings.gradle.kts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
rootProject.name = "ZigBrains"
|
2
src/art/zig/LICENSE
Normal file
2
src/art/zig/LICENSE
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
These files are licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license,
|
||||||
|
property of the Zig Software Foundation.
|
21
src/art/zig/zig.svg
Normal file
21
src/art/zig/zig.svg
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 154 140">
|
||||||
|
<g fill="#F7A41D">
|
||||||
|
<g>
|
||||||
|
<polygon points="46,22 28,44 19,30"/>
|
||||||
|
<polygon points="46,22 33,33 28,44 22,44 22,95 31,95 20,100 12,117 0,117 0,22" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="31,95 12,117 4,106"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<polygon points="56,22 62,36 37,44"/>
|
||||||
|
<polygon points="56,22 111,22 111,44 37,44 56,32" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="116,95 97,117 90,104"/>
|
||||||
|
<polygon points="116,95 100,104 97,117 42,117 42,95" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="150,0 52,117 3,140 101,22"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<polygon points="141,22 140,40 122,45"/>
|
||||||
|
<polygon points="153,22 153,117 106,117 120,105 125,95 131,95 131,45 122,45 132,36 141,22" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="125,95 130,110 106,117"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 831 B |
168
src/art/zig/zigbrains.svg
Normal file
168
src/art/zig/zigbrains.svg
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 154 140"
|
||||||
|
version="1.1"
|
||||||
|
id="svg32"
|
||||||
|
sodipodi:docname="pluginIcon.svg"
|
||||||
|
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs36">
|
||||||
|
<linearGradient
|
||||||
|
id="a"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="-19.526318"
|
||||||
|
x2="131.8147"
|
||||||
|
y1="46.48267"
|
||||||
|
y2="1.6522136">
|
||||||
|
<stop
|
||||||
|
offset=".09"
|
||||||
|
stop-color="#fc801d"
|
||||||
|
id="stop196" />
|
||||||
|
<stop
|
||||||
|
offset=".23"
|
||||||
|
stop-color="#b07f61"
|
||||||
|
id="stop198" />
|
||||||
|
<stop
|
||||||
|
offset=".41"
|
||||||
|
stop-color="#577db3"
|
||||||
|
id="stop200" />
|
||||||
|
<stop
|
||||||
|
offset=".53"
|
||||||
|
stop-color="#1e7ce6"
|
||||||
|
id="stop202" />
|
||||||
|
<stop
|
||||||
|
offset=".59"
|
||||||
|
stop-color="#087cfa"
|
||||||
|
id="stop204" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="c"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="43.479305"
|
||||||
|
x2="97.645195"
|
||||||
|
y1="20.836823"
|
||||||
|
y2="116.85369">
|
||||||
|
<stop
|
||||||
|
offset="0"
|
||||||
|
stop-color="#fe2857"
|
||||||
|
id="stop228" />
|
||||||
|
<stop
|
||||||
|
offset=".08"
|
||||||
|
stop-color="#fe295f"
|
||||||
|
id="stop230" />
|
||||||
|
<stop
|
||||||
|
offset=".21"
|
||||||
|
stop-color="#ff2d76"
|
||||||
|
id="stop232" />
|
||||||
|
<stop
|
||||||
|
offset=".3"
|
||||||
|
stop-color="#ff318c"
|
||||||
|
id="stop234" />
|
||||||
|
<stop
|
||||||
|
offset=".38"
|
||||||
|
stop-color="#ea3896"
|
||||||
|
id="stop236" />
|
||||||
|
<stop
|
||||||
|
offset=".55"
|
||||||
|
stop-color="#b248ae"
|
||||||
|
id="stop238" />
|
||||||
|
<stop
|
||||||
|
offset=".79"
|
||||||
|
stop-color="#5a63d6"
|
||||||
|
id="stop240" />
|
||||||
|
<stop
|
||||||
|
offset="1"
|
||||||
|
stop-color="#087cfa"
|
||||||
|
id="stop242" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview34"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="2.2172848"
|
||||||
|
inkscape:cx="76.219347"
|
||||||
|
inkscape:cy="71.709327"
|
||||||
|
inkscape:window-width="1918"
|
||||||
|
inkscape:window-height="1034"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="g30" />
|
||||||
|
<g
|
||||||
|
fill="#F7A41D"
|
||||||
|
id="g30">
|
||||||
|
<g
|
||||||
|
id="g8"
|
||||||
|
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:url(#a);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1;fill-rule:nonzero">
|
||||||
|
<polygon
|
||||||
|
points="46,22 28,44 19,30"
|
||||||
|
id="polygon2"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#a);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1;fill-rule:nonzero" />
|
||||||
|
<polygon
|
||||||
|
points="28,44 22,44 22,95 31,95 20,100 12,117 0,117 0,22 46,22 33,33 "
|
||||||
|
shape-rendering="crispEdges"
|
||||||
|
id="polygon4"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#a);fill-opacity:1;fill-rule:nonzero;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
inkscape:transform-center-x="-7.3684862"
|
||||||
|
inkscape:transform-center-y="8.702662" />
|
||||||
|
<polygon
|
||||||
|
points="31,95 12,117 4,106"
|
||||||
|
id="polygon6"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#a);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1;fill-rule:nonzero" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g20"
|
||||||
|
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:url(#c);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1">
|
||||||
|
<polygon
|
||||||
|
points="56,22 62,36 37,44"
|
||||||
|
id="polygon10"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#c);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
<polygon
|
||||||
|
points="56,22 111,22 111,44 37,44 56,32"
|
||||||
|
shape-rendering="crispEdges"
|
||||||
|
id="polygon12"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#c);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
<polygon
|
||||||
|
points="116,95 97,117 90,104"
|
||||||
|
id="polygon14"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#c);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
<polygon
|
||||||
|
points="116,95 100,104 97,117 42,117 42,95"
|
||||||
|
shape-rendering="crispEdges"
|
||||||
|
id="polygon16"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#c);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
<polygon
|
||||||
|
points="150,0 52,117 3,140 101,22"
|
||||||
|
id="polygon18"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:url(#c);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g28"
|
||||||
|
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:#087cfa;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1">
|
||||||
|
<polygon
|
||||||
|
points="141,22 140,40 122,45"
|
||||||
|
id="polygon22"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:#087cfa;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
<polygon
|
||||||
|
points="153,22 153,117 106,117 120,105 125,95 131,95 131,45 122,45 132,36 141,22"
|
||||||
|
shape-rendering="crispEdges"
|
||||||
|
id="polygon24"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:#087cfa;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
<polygon
|
||||||
|
points="125,95 130,110 106,117"
|
||||||
|
id="polygon26"
|
||||||
|
style="font-variation-settings:normal;vector-effect:none;fill:#087cfa;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 7.9 KiB |
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.lsp.ZLSEditorEventManager;
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
|
import com.intellij.openapi.editor.markup.HighlighterLayer;
|
||||||
|
import com.intellij.openapi.editor.markup.HighlighterTargetArea;
|
||||||
|
import org.wso2.lsp4intellij.editor.EditorEventManager;
|
||||||
|
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
public class HighlightingUtil {
|
||||||
|
public static void refreshHighlighting(EditorEventManager eem) {
|
||||||
|
var app = ApplicationManager.getApplication();
|
||||||
|
if (!(eem instanceof ZLSEditorEventManager manager)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var editor = manager.editor;
|
||||||
|
if (editor == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
app.runReadAction(() -> {
|
||||||
|
var highlightRanges = manager.semanticHighlighting();
|
||||||
|
var markup = editor.getMarkupModel();
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||||
|
markup.removeAllHighlighters();
|
||||||
|
for (var range: highlightRanges) {
|
||||||
|
markup.addRangeHighlighter(range.color(), range.start(), range.end(), HighlighterLayer.SYNTAX, HighlighterTargetArea.EXACT_RANGE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
22
src/main/java/com/falsepattern/zigbrains/ide/SemaRange.java
Normal file
22
src/main/java/com/falsepattern/zigbrains/ide/SemaRange.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.ide;
|
||||||
|
|
||||||
|
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||||
|
|
||||||
|
public record SemaRange(int start, int end, TextAttributesKey color) {
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.ide;
|
||||||
|
|
||||||
|
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||||
|
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||||
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.*;
|
||||||
|
|
||||||
|
public enum ZigAttributes {
|
||||||
|
Type(CLASS_NAME),
|
||||||
|
Parameter(PARAMETER),
|
||||||
|
Variable(LOCAL_VARIABLE),
|
||||||
|
Enum(GLOBAL_VARIABLE),
|
||||||
|
EnumMember(GLOBAL_VARIABLE),
|
||||||
|
Field(STATIC_FIELD),
|
||||||
|
ErrorTag(CLASS_REFERENCE),
|
||||||
|
Function(FUNCTION_DECLARATION),
|
||||||
|
Keyword(KEYWORD),
|
||||||
|
Comment(LINE_COMMENT),
|
||||||
|
String(STRING),
|
||||||
|
Number(NUMBER),
|
||||||
|
Operator(OPERATION_SIGN),
|
||||||
|
Builtin(STATIC_METHOD),
|
||||||
|
Label(LABEL),
|
||||||
|
KeywordLiteral(KEYWORD),
|
||||||
|
Namespace(CLASS_NAME),
|
||||||
|
Struct(CLASS_NAME)
|
||||||
|
;
|
||||||
|
public final TextAttributesKey KEY;
|
||||||
|
public final String type;
|
||||||
|
public final @Unmodifiable Set<String> modifiers;
|
||||||
|
|
||||||
|
ZigAttributes(TextAttributesKey defaultKey, String... modifiers) {
|
||||||
|
var name = name();
|
||||||
|
int underscoreIndex = name.indexOf('_');
|
||||||
|
type = (underscoreIndex >= 0 ? name.substring(0, underscoreIndex) : name).toLowerCase(Locale.ROOT);
|
||||||
|
KEY = TextAttributesKey.createTextAttributesKey("ZIG_" + name.toUpperCase(Locale.ROOT), defaultKey);
|
||||||
|
this.modifiers = new HashSet<>(List.of(modifiers));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Optional<TextAttributesKey> getKey(String type, Set<String> modifiers) {
|
||||||
|
if (type == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
for (var known: values()) {
|
||||||
|
if (known.type.equals(type) && ((modifiers != null && modifiers.containsAll(known.modifiers)) || (modifiers == null && known.modifiers.size() == 0))) {
|
||||||
|
return Optional.of(known.KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modifiers != null && modifiers.size() > 0) {
|
||||||
|
System.out.println(type + ": " + modifiers);
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.ide;
|
||||||
|
|
||||||
|
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||||
|
import com.intellij.openapi.fileTypes.PlainSyntaxHighlighter;
|
||||||
|
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||||
|
import com.intellij.openapi.options.colors.AttributesDescriptor;
|
||||||
|
import com.intellij.openapi.options.colors.ColorDescriptor;
|
||||||
|
import com.intellij.openapi.options.colors.ColorSettingsPage;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ZigColorSettingsPage implements ColorSettingsPage {
|
||||||
|
|
||||||
|
private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[]{
|
||||||
|
new AttributesDescriptor("Type", ZigAttributes.Type.KEY),
|
||||||
|
new AttributesDescriptor("Parameter", ZigAttributes.Parameter.KEY),
|
||||||
|
new AttributesDescriptor("Variable", ZigAttributes.Variable.KEY),
|
||||||
|
new AttributesDescriptor("Enum member", ZigAttributes.EnumMember.KEY),
|
||||||
|
new AttributesDescriptor("Field", ZigAttributes.Field.KEY),
|
||||||
|
new AttributesDescriptor("Error tag", ZigAttributes.ErrorTag.KEY),
|
||||||
|
new AttributesDescriptor("Function", ZigAttributes.Function.KEY),
|
||||||
|
new AttributesDescriptor("Keyword//Regular", ZigAttributes.Keyword.KEY),
|
||||||
|
new AttributesDescriptor("Keyword//Literal", ZigAttributes.KeywordLiteral.KEY),
|
||||||
|
new AttributesDescriptor("Comment", ZigAttributes.Comment.KEY),
|
||||||
|
new AttributesDescriptor("String", ZigAttributes.String.KEY),
|
||||||
|
new AttributesDescriptor("Number", ZigAttributes.Number.KEY),
|
||||||
|
new AttributesDescriptor("Operator", ZigAttributes.Operator.KEY),
|
||||||
|
new AttributesDescriptor("Builtin", ZigAttributes.Builtin.KEY),
|
||||||
|
new AttributesDescriptor("Label", ZigAttributes.Label.KEY),
|
||||||
|
};
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Icon getIcon() {
|
||||||
|
return ZigIcons.FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SyntaxHighlighter getHighlighter() {
|
||||||
|
return new PlainSyntaxHighlighter();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getDemoText() {
|
||||||
|
return "Preview not yet implemented :/";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AttributesDescriptor @NotNull [] getAttributeDescriptors() {
|
||||||
|
return DESCRIPTORS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ColorDescriptor @NotNull [] getColorDescriptors() {
|
||||||
|
return ColorDescriptor.EMPTY_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return "Zig";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.ide;
|
||||||
|
|
||||||
|
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||||
|
import com.intellij.openapi.util.NlsContexts;
|
||||||
|
import com.intellij.openapi.util.NlsSafe;
|
||||||
|
import org.jetbrains.annotations.NonNls;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
|
||||||
|
public class ZigFileType extends LanguageFileType {
|
||||||
|
public static final ZigFileType INSTANCE = new ZigFileType();
|
||||||
|
private ZigFileType() {
|
||||||
|
super(ZigLanguage.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNls @NotNull String getName() {
|
||||||
|
return "Zig File";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getDescription() {
|
||||||
|
return "ZigLang file";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getDefaultExtension() {
|
||||||
|
return "zig";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Icon getIcon() {
|
||||||
|
return ZigIcons.FILE;
|
||||||
|
}
|
||||||
|
}
|
25
src/main/java/com/falsepattern/zigbrains/ide/ZigIcons.java
Normal file
25
src/main/java/com/falsepattern/zigbrains/ide/ZigIcons.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.ide;
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.IconLoader;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
|
||||||
|
public class ZigIcons {
|
||||||
|
public static final Icon FILE = IconLoader.getIcon("/icons/zig.png", ZigIcons.class);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.ide;
|
||||||
|
|
||||||
|
import com.intellij.lang.Language;
|
||||||
|
|
||||||
|
public class ZigLanguage extends Language {
|
||||||
|
public static final ZigLanguage INSTANCE = new ZigLanguage();
|
||||||
|
|
||||||
|
private ZigLanguage() {
|
||||||
|
super("Zig");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.lsp;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.ide.SemaRange;
|
||||||
|
import com.falsepattern.zigbrains.util.TokenDecoder;
|
||||||
|
import com.intellij.lang.annotation.Annotation;
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.editor.event.DocumentListener;
|
||||||
|
import com.intellij.openapi.editor.event.EditorMouseListener;
|
||||||
|
import com.intellij.openapi.editor.event.EditorMouseMotionListener;
|
||||||
|
import org.eclipse.lsp4j.SemanticTokensParams;
|
||||||
|
import org.eclipse.lsp4j.jsonrpc.JsonRpcException;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.ServerOptions;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.requestmanager.RequestManager;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper;
|
||||||
|
import org.wso2.lsp4intellij.editor.EditorEventManager;
|
||||||
|
import org.wso2.lsp4intellij.listeners.LSPCaretListenerImpl;
|
||||||
|
import org.wso2.lsp4intellij.requests.Timeouts;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
|
import static org.wso2.lsp4intellij.requests.Timeout.getTimeout;
|
||||||
|
|
||||||
|
public class ZLSEditorEventManager extends EditorEventManager {
|
||||||
|
public ZLSEditorEventManager(Editor editor,
|
||||||
|
DocumentListener documentListener,
|
||||||
|
EditorMouseListener mouseListener,
|
||||||
|
EditorMouseMotionListener mouseMotionListener,
|
||||||
|
LSPCaretListenerImpl caretListener,
|
||||||
|
RequestManager requestmanager,
|
||||||
|
ServerOptions serverOptions,
|
||||||
|
LanguageServerWrapper wrapper) {
|
||||||
|
super(editor,
|
||||||
|
documentListener,
|
||||||
|
mouseListener,
|
||||||
|
mouseMotionListener,
|
||||||
|
caretListener,
|
||||||
|
requestmanager,
|
||||||
|
serverOptions,
|
||||||
|
wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized List<Annotation> getAnnotations() {
|
||||||
|
return super.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SemaRange> semanticHighlighting() {
|
||||||
|
var result = new ArrayList<SemaRange>();
|
||||||
|
if (!(getRequestManager() instanceof ZLSRequestManager requestManager)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
var legendOptional = requestManager.sematicLegend();
|
||||||
|
if (legendOptional.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
var legend = legendOptional.get();
|
||||||
|
var request = requestManager.semanticTokens(new SemanticTokensParams(getIdentifier()));
|
||||||
|
if (request == null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var res = request.get(getTimeout(Timeouts.CODEACTION), TimeUnit.MILLISECONDS);
|
||||||
|
wrapper.notifySuccess(Timeouts.CODEACTION);
|
||||||
|
if (res == null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
var responseData = res.getData();
|
||||||
|
return TokenDecoder.decodePayload(editor, legend, responseData);
|
||||||
|
} catch (TimeoutException | InterruptedException e) {
|
||||||
|
LOG.warn(e);
|
||||||
|
wrapper.notifyFailure(Timeouts.COMPLETION);
|
||||||
|
} catch (JsonRpcException | ExecutionException e) {
|
||||||
|
LOG.warn(e);
|
||||||
|
wrapper.crashed(e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.lsp;
|
||||||
|
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.editor.event.DocumentListener;
|
||||||
|
import org.eclipse.lsp4j.ServerCapabilities;
|
||||||
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
|
import org.eclipse.lsp4j.services.LanguageServer;
|
||||||
|
import org.wso2.lsp4intellij.client.ClientContext;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.ServerOptions;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.requestmanager.DefaultRequestManager;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.requestmanager.RequestManager;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper;
|
||||||
|
import org.wso2.lsp4intellij.editor.EditorEventManager;
|
||||||
|
import org.wso2.lsp4intellij.extensions.LSPExtensionManager;
|
||||||
|
import org.wso2.lsp4intellij.listeners.EditorMouseListenerImpl;
|
||||||
|
import org.wso2.lsp4intellij.listeners.EditorMouseMotionListenerImpl;
|
||||||
|
import org.wso2.lsp4intellij.listeners.LSPCaretListenerImpl;
|
||||||
|
|
||||||
|
public class ZLSExtensionManager implements LSPExtensionManager {
|
||||||
|
@Override
|
||||||
|
public <T extends DefaultRequestManager> T getExtendedRequestManagerFor(LanguageServerWrapper wrapper,
|
||||||
|
LanguageServer server,
|
||||||
|
LanguageClient client,
|
||||||
|
ServerCapabilities serverCapabilities) {
|
||||||
|
return (T) new ZLSRequestManager(wrapper, server, client, serverCapabilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends EditorEventManager> T getExtendedEditorEventManagerFor(Editor editor,
|
||||||
|
DocumentListener documentListener,
|
||||||
|
EditorMouseListenerImpl mouseListener,
|
||||||
|
EditorMouseMotionListenerImpl mouseMotionListener,
|
||||||
|
LSPCaretListenerImpl caretListener,
|
||||||
|
RequestManager requestManager,
|
||||||
|
ServerOptions serverOptions,
|
||||||
|
LanguageServerWrapper wrapper) {
|
||||||
|
return (T) new ZLSEditorEventManager(editor, documentListener, mouseListener, mouseMotionListener, caretListener, requestManager, serverOptions, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends LanguageServer> getExtendedServerInterface() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LanguageClient getExtendedClientFor(ClientContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.lsp;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.HighlightingUtil;
|
||||||
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
|
import org.eclipse.lsp4j.DidChangeTextDocumentParams;
|
||||||
|
import org.eclipse.lsp4j.DidOpenTextDocumentParams;
|
||||||
|
import org.eclipse.lsp4j.SemanticTokens;
|
||||||
|
import org.eclipse.lsp4j.SemanticTokensLegend;
|
||||||
|
import org.eclipse.lsp4j.SemanticTokensParams;
|
||||||
|
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
|
||||||
|
import org.eclipse.lsp4j.ServerCapabilities;
|
||||||
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
|
import org.eclipse.lsp4j.services.LanguageServer;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.requestmanager.DefaultRequestManager;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class ZLSRequestManager extends DefaultRequestManager {
|
||||||
|
private static final Logger LOG = Logger.getInstance(ZLSRequestManager.class);
|
||||||
|
|
||||||
|
public ZLSRequestManager(LanguageServerWrapper wrapper,
|
||||||
|
LanguageServer server,
|
||||||
|
LanguageClient client,
|
||||||
|
ServerCapabilities serverCapabilities) {
|
||||||
|
super(wrapper, server, client, serverCapabilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<SemanticTokens> semanticTokens(SemanticTokensParams params) {
|
||||||
|
if (checkStatus()) {
|
||||||
|
try {
|
||||||
|
return (getServerCapabilities().getSemanticTokensProvider() != null) ? getTextDocumentService().semanticTokensFull(params) : null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
crashed(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void didChange(DidChangeTextDocumentParams params) {
|
||||||
|
super.didChange(params);
|
||||||
|
refreshEditorForFile(params.getTextDocument().getUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void didOpen(DidOpenTextDocumentParams params) {
|
||||||
|
super.didOpen(params);
|
||||||
|
refreshEditorForFile(params.getTextDocument().getUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshEditorForFile(String uri) {
|
||||||
|
var editorManager = getWrapper().getEditorManagersFor(uri);
|
||||||
|
if (editorManager != null) {
|
||||||
|
for (var manager : editorManager) {
|
||||||
|
HighlightingUtil.refreshHighlighting(manager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<SemanticTokensLegend> sematicLegend() {
|
||||||
|
if (checkStatus()) {
|
||||||
|
try {
|
||||||
|
return Optional.ofNullable(getServerCapabilities())
|
||||||
|
.map(ServerCapabilities::getSemanticTokensProvider)
|
||||||
|
.map(SemanticTokensWithRegistrationOptions::getLegend);
|
||||||
|
} catch (Exception e) {
|
||||||
|
crashed(e);
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void crashed(Exception e) {
|
||||||
|
LOG.warn(e);
|
||||||
|
getWrapper().crashed(e);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.lsp;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.settings.AppSettingsState;
|
||||||
|
import com.intellij.notification.Notification;
|
||||||
|
import com.intellij.notification.NotificationType;
|
||||||
|
import com.intellij.notification.Notifications;
|
||||||
|
import com.intellij.openapi.project.Project;
|
||||||
|
import com.intellij.openapi.startup.StartupActivity;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.wso2.lsp4intellij.IntellijLanguageClient;
|
||||||
|
import org.wso2.lsp4intellij.client.languageserver.serverdefinition.ProcessBuilderServerDefinition;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.InvalidPathException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class ZLSStartupActivity implements StartupActivity {
|
||||||
|
public static void initZLS() {
|
||||||
|
var pathTxt = AppSettingsState.getInstance().zlsPath;
|
||||||
|
Path path;
|
||||||
|
try {
|
||||||
|
path = Path.of(pathTxt);
|
||||||
|
} catch (InvalidPathException e) {
|
||||||
|
Notifications.Bus.notify(new Notification("ZigBrains.Nag",
|
||||||
|
"No ZLS binary",
|
||||||
|
"Invalid ZLS binary path \"" + pathTxt + "\"",
|
||||||
|
NotificationType.ERROR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Files.exists(path) || Files.isDirectory(path)) {
|
||||||
|
Notifications.Bus.notify(new Notification("ZigBrains.Nag",
|
||||||
|
"No ZLS binary",
|
||||||
|
"The ZLS binary at \"" + pathTxt + "\" doesn't exist or is a directory!",
|
||||||
|
NotificationType.ERROR));
|
||||||
|
}
|
||||||
|
if (IntellijLanguageClient.getExtensionManagerFor("zig") == null) {
|
||||||
|
IntellijLanguageClient.addExtensionManager("zig", new ZLSExtensionManager());
|
||||||
|
}
|
||||||
|
var procBuilder = new ProcessBuilder();
|
||||||
|
procBuilder.command(pathTxt, "--enable-message-tracing");
|
||||||
|
IntellijLanguageClient.addServerDefinition(new ProcessBuilderServerDefinition("zig", procBuilder));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runActivity(@NotNull Project project) {
|
||||||
|
var path = AppSettingsState.getInstance().zlsPath;
|
||||||
|
if ("".equals(path)) {
|
||||||
|
Notifications.Bus.notify(new Notification("ZigBrains.Nag",
|
||||||
|
"No ZLS binary",
|
||||||
|
"Please configure the path to the zls executable in the Zig language configuration menu!",
|
||||||
|
NotificationType.INFORMATION));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
initZLS();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.settings;
|
||||||
|
|
||||||
|
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||||
|
import com.intellij.openapi.ui.TextBrowseFolderListener;
|
||||||
|
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||||
|
import com.intellij.ui.components.JBLabel;
|
||||||
|
import com.intellij.util.ui.FormBuilder;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
public class AppSettingsComponent {
|
||||||
|
private final JPanel myMainPanel;
|
||||||
|
private final TextFieldWithBrowseButton zlsPathText = new TextFieldWithBrowseButton();
|
||||||
|
public AppSettingsComponent() {
|
||||||
|
zlsPathText.addBrowseFolderListener(new TextBrowseFolderListener(new FileChooserDescriptor(true, false, false, false, false, false)));
|
||||||
|
myMainPanel = FormBuilder.createFormBuilder()
|
||||||
|
.addLabeledComponent(new JBLabel("ZLS path: "), zlsPathText, 1, false)
|
||||||
|
.addComponentFillVertically(new JPanel(), 0)
|
||||||
|
.getPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JPanel getPanel() {
|
||||||
|
return myMainPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public String getZlsPathText() {
|
||||||
|
return zlsPathText.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZlsPathText(@NotNull String newText) {
|
||||||
|
zlsPathText.setText(newText);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.settings;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.lsp.ZLSStartupActivity;
|
||||||
|
import com.intellij.openapi.options.Configurable;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
|
public class AppSettingsConfigurable implements Configurable {
|
||||||
|
private AppSettingsComponent appSettingsComponent;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return "Zig";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable JComponent createComponent() {
|
||||||
|
appSettingsComponent = new AppSettingsComponent();
|
||||||
|
return appSettingsComponent.getPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isModified() {
|
||||||
|
var settings = AppSettingsState.getInstance();
|
||||||
|
return !settings.zlsPath.equals(appSettingsComponent.getZlsPathText());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
var settings = AppSettingsState.getInstance();
|
||||||
|
settings.zlsPath = appSettingsComponent.getZlsPathText();
|
||||||
|
ZLSStartupActivity.initZLS();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
var settings = AppSettingsState.getInstance();
|
||||||
|
appSettingsComponent.setZlsPathText(settings.zlsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disposeUIResources() {
|
||||||
|
appSettingsComponent = null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.settings;
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
|
import com.intellij.openapi.components.PersistentStateComponent;
|
||||||
|
import com.intellij.openapi.components.Service;
|
||||||
|
import com.intellij.openapi.components.State;
|
||||||
|
import com.intellij.openapi.components.Storage;
|
||||||
|
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@Service(Service.Level.PROJECT)
|
||||||
|
@State(
|
||||||
|
name = "com.falsepattern.zigbrains.settings.AppSettingsState",
|
||||||
|
storages = @Storage("ZigBrainsSettings.xml")
|
||||||
|
)
|
||||||
|
public final class AppSettingsState implements PersistentStateComponent<AppSettingsState> {
|
||||||
|
public String zlsPath = "";
|
||||||
|
|
||||||
|
public static AppSettingsState getInstance() {
|
||||||
|
return ApplicationManager.getApplication().getService(AppSettingsState.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable AppSettingsState getState() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadState(@NotNull AppSettingsState state) {
|
||||||
|
XmlSerializerUtil.copyBean(state, this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 FalsePattern
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.zigbrains.util;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.ide.ZigAttributes;
|
||||||
|
import com.falsepattern.zigbrains.ide.SemaRange;
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.editor.LogicalPosition;
|
||||||
|
import com.intellij.openapi.util.Computable;
|
||||||
|
import org.eclipse.lsp4j.SemanticTokensLegend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class TokenDecoder {
|
||||||
|
private record Token(int line, int start, int length, int type, int modifiers) {
|
||||||
|
public static Token from(Token prevToken, List<Integer> data, int index) {
|
||||||
|
int line = data.get(index);
|
||||||
|
int start = data.get(index + 1);
|
||||||
|
if (prevToken != null) {
|
||||||
|
if (line == 0) {
|
||||||
|
start += prevToken.start();
|
||||||
|
}
|
||||||
|
line += prevToken.line();
|
||||||
|
}
|
||||||
|
return new Token(line, start, data.get(index + 2), data.get(index + 3), data.get(index + 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static List<SemaRange> decodePayload(Editor editor, SemanticTokensLegend legend, List<Integer> responseData) {
|
||||||
|
var result = new ArrayList<SemaRange>();
|
||||||
|
var application = ApplicationManager.getApplication();
|
||||||
|
int dataSize = responseData.size();
|
||||||
|
|
||||||
|
Token prevToken = null;
|
||||||
|
var types = legend.getTokenTypes();
|
||||||
|
var modifiers = legend.getTokenModifiers();
|
||||||
|
var modCount = Math.min(31, modifiers.size());
|
||||||
|
for (int i = 0; i < dataSize - 5; i += 5) {
|
||||||
|
var token = Token.from(prevToken, responseData, i);
|
||||||
|
var logiPosStart = new LogicalPosition(token.line(), token.start());
|
||||||
|
int tokenStartOffset = application.runReadAction((Computable<Integer>) () -> editor.logicalPositionToOffset(logiPosStart));
|
||||||
|
var type = types.size() > token.type() ? types.get(token.type()) : null;
|
||||||
|
Set<String> modifierSet = null;
|
||||||
|
if (token.modifiers() != 0) {
|
||||||
|
modifierSet = new HashSet<>();
|
||||||
|
for (int m = 0; m < modCount; m++) {
|
||||||
|
if ((token.modifiers() & (1 << m)) != 0) {
|
||||||
|
modifierSet.add(modifiers.get(m));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var key = ZigAttributes.getKey(type, modifierSet);
|
||||||
|
key.ifPresent(textAttributesKey -> result.add(
|
||||||
|
new SemaRange(tokenStartOffset, tokenStartOffset + token.length(), textAttributesKey)));
|
||||||
|
prevToken = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
95
src/main/resources/META-INF/plugin.xml
Normal file
95
src/main/resources/META-INF/plugin.xml
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
|
||||||
|
<idea-plugin>
|
||||||
|
<id>com.falsepattern.zigbrains</id>
|
||||||
|
<name>ZigBrains</name>
|
||||||
|
<vendor>FalsePattern</vendor>
|
||||||
|
|
||||||
|
<depends>com.intellij.modules.platform</depends>
|
||||||
|
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<!-- region LSP4IntelliJ -->
|
||||||
|
|
||||||
|
<!-- register intellijLanguageClient as a Service OR as a plugin component (see readme)... -->
|
||||||
|
<applicationService serviceImplementation="org.wso2.lsp4intellij.IntellijLanguageClient"/>
|
||||||
|
|
||||||
|
<!-- register a listener on editor events, required for lsp file sync -->
|
||||||
|
<editorFactoryListener implementation="org.wso2.lsp4intellij.listeners.LSPEditorListener"/>
|
||||||
|
<fileDocumentManagerListener implementation="org.wso2.lsp4intellij.listeners.LSPFileDocumentManagerListener"/>
|
||||||
|
|
||||||
|
<!-- for displaying notifications by lsp -->
|
||||||
|
<notificationGroup id="lsp" displayType="STICKY_BALLOON"/>
|
||||||
|
|
||||||
|
<!-- for displaying the statusbar icon -->
|
||||||
|
<statusBarWidgetFactory implementation="org.wso2.lsp4intellij.statusbar.LSPServerStatusWidgetFactory"
|
||||||
|
id="org.wso2.lsp4intellij.statusbar.LSPServerStatusWidgetFactory"
|
||||||
|
order="first" />
|
||||||
|
|
||||||
|
<!-- needed for completion -->
|
||||||
|
<completion.contributor implementationClass="org.wso2.lsp4intellij.contributors.LSPCompletionContributor"
|
||||||
|
id="org.wso2.lsp4intellij.contributors.LSPCompletionContributor" language="Zig"/>
|
||||||
|
<!-- needed for completion as well as signature help -->
|
||||||
|
<typedHandler implementation="org.wso2.lsp4intellij.listeners.LSPTypedHandler"
|
||||||
|
id="LSPTypedHandler"/>
|
||||||
|
|
||||||
|
<!-- needed for code diagnostics -->
|
||||||
|
<externalAnnotator id="LSPAnnotator" language="Zig"
|
||||||
|
implementationClass="org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator"/>
|
||||||
|
|
||||||
|
<!-- needed for Workspace Symbols -->
|
||||||
|
<gotoSymbolContributor implementation="org.wso2.lsp4intellij.contributors.symbol.LSPSymbolContributor"
|
||||||
|
id="LSPSymbolContributor"/>
|
||||||
|
|
||||||
|
<!-- needed for renaming -->
|
||||||
|
<renameHandler implementation="org.wso2.lsp4intellij.contributors.rename.LSPRenameHandler" id="LSPRenameHandler" order="first"/>
|
||||||
|
<renamePsiElementProcessor implementation="org.wso2.lsp4intellij.contributors.rename.LSPRenameProcessor" id="LSPRenameProcessor" order="first"/>
|
||||||
|
|
||||||
|
<!-- endregion LSP4IntelliJ -->
|
||||||
|
|
||||||
|
<fileType name="Zig File"
|
||||||
|
implementationClass="com.falsepattern.zigbrains.ide.ZigFileType"
|
||||||
|
fieldName="INSTANCE"
|
||||||
|
language="Zig"
|
||||||
|
extensions="zig"/>
|
||||||
|
|
||||||
|
<colorSettingsPage implementation="com.falsepattern.zigbrains.ide.ZigColorSettingsPage"/>
|
||||||
|
|
||||||
|
<projectConfigurable
|
||||||
|
parentId="language"
|
||||||
|
instance="com.falsepattern.zigbrains.settings.AppSettingsConfigurable"
|
||||||
|
id="com.falsepattern.zigbrains.settings.AppSettingsConfigurable"
|
||||||
|
displayName="Zig"/>
|
||||||
|
|
||||||
|
<postStartupActivity implementation="com.falsepattern.zigbrains.lsp.ZLSStartupActivity"/>
|
||||||
|
<notificationGroup displayType="BALLOON" id="ZigBrains.Nag"/>
|
||||||
|
|
||||||
|
</extensions>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<!-- region LSP4IntelliJ -->
|
||||||
|
|
||||||
|
<!-- needed for hover -->
|
||||||
|
<action id="org.intellij.sdk.action.QuickDocAction" class="org.wso2.lsp4intellij.actions.LSPQuickDocAction">
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<!-- needed for find references -->
|
||||||
|
<action class="org.wso2.lsp4intellij.actions.LSPReferencesAction" id="LSPFindUsages">
|
||||||
|
<keyboard-shortcut first-keystroke="shift alt F7" keymap="$default"/>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<!-- endregion LSP4IntelliJ -->
|
||||||
|
</actions>
|
||||||
|
|
||||||
|
<applicationListeners>
|
||||||
|
<!-- region LSP4IntelliJ -->
|
||||||
|
|
||||||
|
<!-- required for lsp file sync -->
|
||||||
|
<listener class="org.wso2.lsp4intellij.listeners.VFSListener"
|
||||||
|
topic="com.intellij.openapi.vfs.VirtualFileListener"/>
|
||||||
|
<listener class="org.wso2.lsp4intellij.listeners.LSPProjectManagerListener"
|
||||||
|
topic="com.intellij.openapi.project.ProjectManagerListener"/>
|
||||||
|
|
||||||
|
<!-- endregion LSP4IntelliJ -->
|
||||||
|
</applicationListeners>
|
||||||
|
|
||||||
|
|
||||||
|
</idea-plugin>
|
2
src/main/resources/META-INF/pluginIcon.svg
Normal file
2
src/main/resources/META-INF/pluginIcon.svg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg version="1.1" viewBox="0 0 154 140" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="a" x1="-19.526" x2="131.81" y1="46.483" y2="1.6522" gradientUnits="userSpaceOnUse"><stop stop-color="#fc801d" offset=".09"/><stop stop-color="#b07f61" offset=".23"/><stop stop-color="#577db3" offset=".41"/><stop stop-color="#1e7ce6" offset=".53"/><stop stop-color="#087cfa" offset=".59"/></linearGradient><linearGradient id="c" x1="43.479" x2="97.645" y1="20.837" y2="116.85" gradientUnits="userSpaceOnUse"><stop stop-color="#fe2857" offset="0"/><stop stop-color="#fe295f" offset=".08"/><stop stop-color="#ff2d76" offset=".21"/><stop stop-color="#ff318c" offset=".3"/><stop stop-color="#ea3896" offset=".38"/><stop stop-color="#b248ae" offset=".55"/><stop stop-color="#5a63d6" offset=".79"/><stop stop-color="#087cfa" offset="1"/></linearGradient></defs><g><g fill="url(#a)" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"><polygon points="46 22 28 44 19 30" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="28 44 22 44 22 95 31 95 20 100 12 117 0 117 0 22 46 22 33 33" shape-rendering="crispEdges" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="31 95 12 117 4 106" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/></g><g fill="url(#c)" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"><polygon points="56 22 62 36 37 44" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="56 22 111 22 111 44 37 44 56 32" shape-rendering="crispEdges" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="116 95 97 117 90 104" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="116 95 100 104 97 117 42 117 42 95" shape-rendering="crispEdges" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="150 0 52 117 3 140 101 22" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/></g><g fill="#087cfa" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"><polygon points="141 22 140 40 122 45" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="153 22 153 117 106 117 120 105 125 95 131 95 131 45 122 45 132 36 141 22" shape-rendering="crispEdges" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/><polygon points="125 95 130 110 106 117" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/></g></g></svg>
|
After Width: | Height: | Size: 2.7 KiB |
21
src/main/resources/icons/zig.svg
Normal file
21
src/main/resources/icons/zig.svg
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 154 140">
|
||||||
|
<g fill="#F7A41D">
|
||||||
|
<g>
|
||||||
|
<polygon points="46,22 28,44 19,30"/>
|
||||||
|
<polygon points="46,22 33,33 28,44 22,44 22,95 31,95 20,100 12,117 0,117 0,22" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="31,95 12,117 4,106"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<polygon points="56,22 62,36 37,44"/>
|
||||||
|
<polygon points="56,22 111,22 111,44 37,44 56,32" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="116,95 97,117 90,104"/>
|
||||||
|
<polygon points="116,95 100,104 97,117 42,117 42,95" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="150,0 52,117 3,140 101,22"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<polygon points="141,22 140,40 122,45"/>
|
||||||
|
<polygon points="153,22 153,117 106,117 120,105 125,95 131,95 131,45 122,45 132,36 141,22" shape-rendering="crispEdges"/>
|
||||||
|
<polygon points="125,95 130,110 106,117"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 850 B |
Loading…
Add table
Reference in a new issue