Plugin with 2 Custom Language Supports
已回答
Baseline: We wrote an Intellij Plugin with Custom Language Support, using file-extension ".asd". Using gradle as build tool, adding a "generateLexer" and "generateParser" task:
Task: Extend the plugin for a different Custom Language. E.g. with extension ".qwe":
Question:
1. is possible to generate 2 Lexers in one module? Note that these Languages are always used together, so it makes sense to let users install 1 plugin for both languages.
2a. If so: how to do that? how does the build.gradle file look like?
2b. if not; We would basically implement 2 plugins separately and let one depend on the other... (we did something like that already, but the old one is not based on gradle and that shall change)
请先登录再写评论。
Hi,
Yes, it is possible.
You can disable the existing (for consistency) and create new tasks for your languages (I'll use build.gradle.kts syntax):
Such a setup will result in having 4 tasks:
- generateAsdLexer and generateXyzLexer
- generateAsdParser and generateXyzParser
that will be a part of the build lifecycle (thanks to specified dependsOn()).
Hi Neskemiquel,
Could you please clarify the issue? Did you try my solution?
Hi Karol Lewandowski,
thanks for your detailed description! Works great!
We used to have a build.gradle (in Groovy) that I migrated to Kotlin now, as I couldn't find anything regarding "org.jetbrains.grammarkit.tasks.GenerateLexerTask" and "org.jetbrains.grammarkit.tasks.GenerateParserTask" for Groovy so far. Not sure if that was really necessary but it wasn't a big deal... :)