ununhexium / idea-motoko-plugin

IntelliJ IDEA Motoko support
0 stars 1 forks source link

Unresolved reference: MotokoTypes #1

Open andr1972 opened 2 years ago

andr1972 commented 2 years ago

I am using latest gradle version 7.4 and call gradle buildPlugin

I have warnings and errors:

$ gradle buildPlugin

Task :compileKotlin FAILED w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath: /home/andrzej/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.32/461367948840adbb0839c51d91ed74ef4a9ccb52/kotlin-stdlib-1.4.32.jar (version 1.4) /home/andrzej/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2020.2.4/b1d028673e39dbecbf4aa2a2bcd4f2a72f8860da/ideaIC-2020.2.4/lib/kotlin-reflect-1.3.70.jar (version 1.3) /home/andrzej/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2020.2.4/b1d028673e39dbecbf4aa2a2bcd4f2a72f8860da/ideaIC-2020.2.4/lib/kotlin-stdlib-1.3.70.jar (version 1.3) /home/andrzej/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2020.2.4/b1d028673e39dbecbf4aa2a2bcd4f2a72f8860da/ideaIC-2020.2.4/lib/kotlin-stdlib-common-1.3.70.jar (version 1.3) /home/andrzej/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2020.2.4/b1d028673e39dbecbf4aa2a2bcd4f2a72f8860da/ideaIC-2020.2.4/lib/kotlin-stdlib-jdk7-1.3.70.jar (version 1.3) /home/andrzej/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2020.2.4/b1d028673e39dbecbf4aa2a2bcd4f2a72f8860da/ideaIC-2020.2.4/lib/kotlin-stdlib-jdk8-1.3.70.jar (version 1.3) /home/andrzej/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.32/ef50bfa2c0491a11dcc35d9822edbfd6170e1ea2/kotlin-stdlib-common-1.4.32.jar (version 1.4) w: Consider providing an explicit dependency on kotlin-reflect 1.4 to prevent strange errors w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (8, 28): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (17, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (29, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (30, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (31, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (35, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (36, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (37, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (38, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (39, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (40, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (41, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (42, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (43, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (44, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (45, 7): Unresolved reference: MotokoTypes e: /home/andrzej/github/idea-motoko-plugin/src/main/java/net/lab0/motoko/MotokoSyntaxHighlighter.kt: (46, 7): Unresolved reference: MotokoTypes ...................................etc MotokoTypes

andr1972 commented 2 years ago

I must first compile .bnf and .flex and generate java sources:

  1. Open project in Intellij Idea IDE
  2. install plugin Grammar-Kit
  3. Run Jflex generator
  4. Build in terminal with gradle buildPlugin
  5. Install plugin from idea-motoko-plugin/build/distributions/motoko_language_plugin-2.0.0.zip (note, untilBuild in build.gradle must be changed to 213 or above IDE version)
ununhexium commented 2 years ago

Hi @borneq ,

Please note that this is just a toy project. It parses most of the Motoko syntax but I ended up at a point where I got 2 valid Motoko code snippets, but was only able to correctly parse either one or the other, but never both at the same time.

A better approach is to implement this via LSP (Language Server Protocol) and get all the info from there. There is a (dead?) project to add LSP support to IJ already available and it was kinda working with Motoko.

In either case, implementing a fully functional plugin was too much work for me to bother anymore and I just gave up.