Ruin0x11/intellij-lsp-server

Android Studio support

Closed this issue · 9 comments

Hi!

I tried installing the plugin in Android Studio and it looks like Android Studio has a build version too low for the server.

I think Android Studio 3.2 (beta) is at build 173 whereas the minimum for lsp-server is at 181.

I played around with changing the minimum version in plugin.xml to 173 but then it stops on

org.jetbrains.idea.maven being a missing dependency.

Not sure how feasible it would be to support Android Studio but I'd thought I'd bring it up.

Hmm, didn't realize that a version upgrade would bring that incompatibility. I'll see if I can return it to 173.

Ok, I figured out that the builtin IntelliJ Maven Integration plugin is disabled in Android Studio and there seems to be no obvious way around this, so I made the Maven plugin an optional dependency. This lets the plugin be installed. However, there is no actual support yet since the project structure is special and would have to be handled separately. But it looks like Android support could be added in the future and I was planning on doing so eventually.

For now I'll merge the branch which reverts to build 173 so no other compatibility issues arise in the future and open a new issue regarding Android support.

Sounds good, this is what I get in Android Studio 3.2 beta.

Plugin 'com.ruin.lsp' failed to initialize and will be disabled.  Please restart Android Studio.

java.lang.NoClassDefFoundError: org/eclipse/lsp4j/services/LanguageServer
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
    at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:279)
    at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:275)
    at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:244)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:142)
    at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:74)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:61)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.ruin.lsp.model.LanguageServerService.<init>(LanguageServerRunner.kt:98)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:103)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:80)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:63)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:474)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:119)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$createComponents$9(ApplicationImpl.java:447)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
    at com.intellij.openapi.application.impl.ApplicationImpl.createComponents(ApplicationImpl.java:454)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:103)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:406)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:392)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:206)
    at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:49)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:346)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: org.eclipse.lsp4j.services.LanguageServer PluginClassLoader[com.ruin.lsp, 0.1] com.intellij.ide.plugins.cl.PluginClassLoader@102aa8ca
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 48 more

This is the jar I'm using.

libs/ $ pwd
/Users/james/.emacs.d/fork/intellij-lsp-server/build/libs
libs/ $ ls
intellij-lsp-server-0.1.jar
libs/ $ 

I haven't actually made a release in a while, should get around to it. The lastest code on master shouldn't have issues.

This is the commit I'm using.

57965e3

Can't seem to reproduce on my end, although I run Windows. Which OS are you using?

OSX

Closing in favor of #46. Because of the way the plugin uses internal APIs it would be a pain to support 173 alongside 181. IntelliJ comes with the same Android support that Android Studio has, so there shouldn't be a huge loss to migrating over.

I'll give it a shot and update this thread.