Using IntelliJ "as a library"

Answered

I would like to use code from an IntelliJ plugin in my own code. Specifically, https://github.com/asciidoctor/asciidoctor-intellij-plugin has an AsciiDoc parser, which is a piece of software that is hard to come by. I'd like to invoke that parser in a command-line tool to extract an AST and write it as a JSON or something.

This plugin has extensive tests that demonstrate how to call into the code from outside IntelliJ, but it's complex and I wonder if there's a better way. As I see, I need to setup a good chunk of the IntelliJ architecture.

I wonder if there's any generic "mock" of that which can be instantiated easily, or even a way to set up the whole IntelliJ architecture of classes...

4 comments
Comment actions Permalink

Alex, I'd suggest you redirect such a question directly to the plugin's author.

0
Comment actions Permalink

Hi,

I don't think that's up to the plugin. I can use the plugin's code just fine (it's a parser). However, if I try to build my code using the plugin's code in a standalone project, I get *tons* of pain. I've basically narrowed it down to a bunch of dependencies in a "3rd-party.jar" library that seems to be included in the plugin by the IntelliJ Gradle plugin... which I cannot add to my own Gradle, non-IntelliJ plugin project :\

Cheers,

Álex

0
Comment actions Permalink

See https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html#using-intellij-platform-module-artifacts on how to obtain required artifacts. But in general, it is very hard/impossible to make code work "Standalone" without IDE instance.

1
Comment actions Permalink

Ah, in the end I got it working (see https://github.com/alexpdp7/asciidoc-ast/ , it's not very well-documented, but it works)... I think I missed that link, and it would probably have helped- I'll review that anyway, thanks!

0

Please sign in to leave a comment.