Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can LanguageSupport be generalized to be used for other JVM languages (e.g. Kotlin) #807

Closed
jimmypoms opened this issue Feb 5, 2019 · 9 comments
Labels

Comments

@jimmypoms
Copy link

I really like the approach the groovy-eclipse plugin takes in integrating with JDT through a compiler patch. I was wondering whether the compiler patch could be generalized to provide an extension point for other JVM languages, specifically Kotlin.

Thought it is worth to ask for input/directions before giving it a shot by myself ;).

@eric-milles
Copy link
Member

The LanguageSupportFactory was certainly designed with this in mind. To get started, you could use the JDT Core patch project as-is. And then you would supply an impl much the same as the GDT Core plug-in does.

@jimmypoms
Copy link
Author

jimmypoms commented Feb 5, 2019

This is exactly the answer I was hoping for :)

However, browsing through the code, I do get a little fuzzy about where the implementations are supposed to be switched. It seems like as soon as the groovy plugin is present LanguageSupportFactory will only ever use the GroovyLanguageSupport, having static state and all.

In any case, these are my initial thoughts on going about implementing support other JVM languages:

  • Switch implementations in LanguageSupportFactory based on respective arguments caching wherever possible
  • Define extension point for additional implementations
  • Make the groovy plugin use the extension point

I hope that makes sense.

@eric-milles
Copy link
Member

Yes, good observation. LanguageSupportFactory.getLanguageSupport should be selecting from many available LanguageSupport impls. Or there should be one that knows how to handle all supported languages. That is an unfinished part of the design.

You could swap out the fully-qualified name of the Groovy LS impl for your just to see you can handle your content type.

@eric-milles
Copy link
Member

Just wanted to note that I think the Language Server Protocol initiative (see also https://github.com/eclipse/eclipse.jdt.ls) is probably where community effort/support is going.

@jimmypoms
Copy link
Author

Thank you for the quick reply.

I will check the links and will probably give it a shot with the extension point :).

@felixdo
Copy link
Contributor

felixdo commented Mar 29, 2019

Just wanted to note that I think the Language Server Protocol initiative (see also https://github.com/eclipse/eclipse.jdt.ls) is probably where community effort/support is going.

Do you not think that this will change little for groovy-eclipse: Rather than patching the jdt itself, we'd now have to patch the jdt-ls?

@felixdo
Copy link
Contributor

felixdo commented Mar 29, 2019

Hmm, maybe not: If the groovy-ls sits on top of the java-ls, like a proxy, maybe things could be much cleaner.

@eric-milles
Copy link
Member

From what I have gathered about how JDT-LS is implemented, a thin client-server layer has been inserted between the Java Editor and the JDT backend. To continue to support joint compilation with Java, the Groovy enhancements to JDT will still need to be patched into the backend. If a standalone language server was created for Groovy, I think the Java interoperability would take a big hit.

@mojo2012
Copy link

The last days I have been trying to apply the jdt.core patch to jdt-ls - so far without luck. It's far from being a standard maven build (which would make it pretty easy to switch a depencendy).
If someone of you is willing to point me in the right direction/support me, it would be very appreciated.

What I found out so far is that jdt-ls just uses the jdt.core compiler (osgi?) plugin, which in fact is patched by groovy-eclipse. So it should be possible to swap the jdt-ls jdt.core plugin with a patched jdt.core plugin.
I guess there's is some more work to be done, but at least it could be a starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants