Closed barsan-md closed 5 years ago
I've been looking into this. Specifically, what it would take to port some of the work that's been done on the various platform plugins. Unfortunately most of the APIs there are heavily undocumented and tightly coupled to the IntelliJ platform as expected.
Simply put, it's non-trivial.
Right now I think the most reasonable way to go with the lowest level of effort is actually to port over work done from the Eclipse plugin. However, unfortunately, this is also mostly undocumented using what seem to be poritons of the idea plugin repackaged.
You are right about the Eclipse plugin, yet I've looked a little in the files and I could not understand the architecture (without knowledge about the plugin system of Eclipse or Idea). Even tough there is a modest attempt to document the code, the information is far from enough. Also I suspect that creating a CLI wrapper around the stuff delivered with kotlin is much harder than what this plugin does, after all java can use kotlin directly.
In my opinion the most immediate chance to add features to this plugin with the minimum amount of work is using klint and possibly (?) detekt
I think pulling in ktlint
is interesting. I'll have to look into it a bit further.
For some of the other capabilities, I recently discovered this project which implements the language server protocol for Kotlin. It's using a lot of the same techniques that the eclipse plugin uses for features like autocomplete and jump-to-definition. I think it would be best to contribute features such as the code formatter changes to that project. 🤔
The owner of kotlin-language-server has apparently removed the extension from the marketplace thus making this the only Kotlin extension left.
Integrating a language server would definitely improve the experience immensely and make it viable alternative to IDEA.
If anyone is interested, I have forked kotlin-language-server and done quite some work on supporting both Gradle and Maven projects. I would definitely appreciate any help to eliminate the last bugs.
@fwcd Thanks for doing this. It was on my todo to spend some time looking at the project. I would like to integrate it into this project if possible
@nishtahir Sure, that would definitely be possible. You could add my kotlin-language-server fork as a Git submodule, ignore the VSCode extension code in the language server repo (might want to add that to your .vscodeignore?) and call the appropriate start scripts from your extension.
Note that you would have to do a Gradle build yourself every time you pull an updated version of the language server.
@nishtahir Some time has passed and the language server extension (together with the debug extension) has more or less evolved to a fully functional solution for Kotlin development.
What do you think about treating either this repo or language-kotlin as an upstream repository where all Grammar development is done and do all language smartness downstream?
Yeah, that's a good idea. I would like this repository to continue to remain a simple lightweight syntax highlighting plugin and allow fwcd/KotlinLanguageServer to be the fully featured solution. nishtahir/language-kotlin should be the upstream grammar for syntax highlighting as it's being used on GitHub as well.
I'm wondering how much work would require to integrate the plugin used by intellij idea community edition. It has a lot of features including static analysis, formatter, goto declaration, refactor and similar stuff. What do you think, is it doable?