asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
354 stars 145 forks source link

Error when enabling Kroki in WebStorm #365

Closed ggrossetie closed 4 years ago

ggrossetie commented 4 years ago

Sample document

= Diagrams

== Block diagram

:action: generates

[blockdiag,block-diag,svg,subs=+attributes]
----
blockdiag {
  Kroki -> {action} -> "Block diagrams";
  Kroki -> is -> "very easy!";

  Kroki [color = "greenyellow"];
  "Block diagrams" [color = "pink"];
  "very easy!" [color = "orange"];
}
----

Stack trace

2019-11-09 10:41:26,340 [1311193]   WARN - org.asciidoc.intellij.AsciiDoc - unable to render AsciiDoc document 
org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document - wrong number of arguments (given 3, expected 1..2)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convert(JRubyAsciidoctor.java:314)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convert(JRubyAsciidoctor.java:277)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:448)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:428)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:424)
    at org.asciidoc.intellij.editor.AsciiDocPreviewEditor.lambda$render$0(AsciiDocPreviewEditor.java:141)
    at org.asciidoc.intellij.editor.LazyApplicationPoolExecutor.lambda$execute$0(LazyApplicationPoolExecutor.java:60)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document - wrong number of arguments (given 3, expected 1..2)
2019-11-09 10:41:26,611 [1311464]   WARN - org.asciidoc.intellij.AsciiDoc - unable to render AsciiDoc document 
org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document - wrong number of arguments (given 3, expected 1..2)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convert(JRubyAsciidoctor.java:314)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convert(JRubyAsciidoctor.java:277)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:448)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:428)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:424)
    at org.asciidoc.intellij.editor.AsciiDocPreviewEditor.lambda$render$0(AsciiDocPreviewEditor.java:141)
    at org.asciidoc.intellij.editor.LazyApplicationPoolExecutor.lambda$execute$0(LazyApplicationPoolExecutor.java:60)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document - wrong number of arguments (given 3, expected 1..2)
2019-11-09 10:41:26,946 [1311799]   WARN - org.asciidoc.intellij.AsciiDoc - unable to render AsciiDoc document 
org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document - wrong number of arguments (given 3, expected 1..2)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convert(JRubyAsciidoctor.java:314)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convert(JRubyAsciidoctor.java:277)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:448)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:428)
    at org.asciidoc.intellij.annotator.ExternalAnnotator.doAnnotate(ExternalAnnotator.java:77)
    at org.asciidoc.intellij.annotator.ExternalAnnotator.doAnnotate(ExternalAnnotator.java:38)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:203)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:39)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$1(ExternalToolPass.java:179)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.lambda$runUnderDisposeAwareIndicator$11(BackgroundTaskUtil.java:244)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$3(CoreProgressManager.java:185)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:185)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:264)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:243)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:178)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:324)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:314)
    at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:264)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:278)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:233)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:231)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:368)
    at com.intellij.util.Alarm$Request.run(Alarm.java:355)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:224)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:207)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$100(BoundedTaskExecutor.java:29)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.lambda$run$0(BoundedTaskExecutor.java:185)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:181)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document - wrong number of arguments (given 3, expected 1..2)

AsciiDoc Plugin Version: 0.30.16 IDE Name and Version:

WebStorm 2019.2.4
Build #WS-192.7142.35, built on October 29, 2019
Subscription is active until November 27, 2019
Runtime version: 11.0.4+10-b304.77 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-58-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: net.seesharpsoft.intellij.plugins.csv, org.asciidoctor.intellij.asciidoc, org.jetbrains.plugins.slim, BashSupport, org.toml.lang
ggrossetie commented 4 years ago

I think it's because I'm using:

https://github.com/asciidoctor/asciidoctor-intellij-plugin/blob/e6cd592ae61c9474d4cfe688a71034542095375d/src/main/resources/kroki-extension.rb#L48

This line was actually ported from the PlantUML extension (JavaScript) to the Kroki extension (JavaScript) to the Ruby extension :sweat_smile:

ggrossetie commented 4 years ago

Should we write Ruby tests to test the extension in this repository?

ahus1 commented 4 years ago

Thanks for reporting and fixing this!

In the best of worlds I would like to see

Adding the Kroki extension to asciidoctor-extensions-lab would be a start, but I'm afraid that this doesn't have continuous integration tests set up.

ahus1 commented 4 years ago

... to answer your original question:

Keeping only JUnit tests around would reduce the complexity of the project in terms or technologies/concepts used IMHO. I'd accept the downside that tests run more slowly and take more lines to write.

Therefore I'd rather have JUnit tests in this project; either as integration tests that the extension is loaded properly, or as a tests to cover its functionality while there are no ruby tests around in a separate project.

I am happy to discuss this opinion.

ahus1 commented 4 years ago

This is fixed in release 0.30.18. The new release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository. It will be available from the regular repository later today.

ggrossetie commented 4 years ago

Adding the Kroki extension to asciidoctor-extensions-lab would be a start, but I'm afraid that this doesn't have continuous integration tests set up.

I think it should have its own repository with a tests suite.

the Kroki Ruby extension for Asciidoctor to have its own project to become visible outside the IntelliJ plugin and get the adaption it deserves. This project would be 100% Ruby based, including ruby based tests (something for the future)

👍

a JUnit based integration test for Kroki within this project (that we already have today)

We should add a test when Kroki is enabled and the diagram block has subs: https://github.com/asciidoctor/asciidoctor-intellij-plugin/blob/cc7f6378b25cc0b57c085eb9c0983719f9bf9814/src/test/java/org/asciidoc/intellij/AsciiDocTest.java#L128