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

Does this work with JerBrains Client (for remote Gateway)? #143

Open
UnbridledGames opened this issue Sep 11, 2022 · 8 comments
Open

Does this work with JerBrains Client (for remote Gateway)? #143

UnbridledGames opened this issue Sep 11, 2022 · 8 comments

Comments

@UnbridledGames
Copy link

I've spent three hours trying to get this to work for a remote project I'm working on. The best I've done is get the popup-menu to run, yet when I use the key-combo to get the popup to show, nothing happens. When I use the plugin in PyCharm locally, it works fine. In the JetBrains Client... nothing.

I've been banging my head against a custom language plugin (extending some features in yaml files) and have never even seen enough concise documentation to get anything to compile correctly... so when I saw LivePlugin I was super excited... and at this point I don't know if I'm doing something wrong, or if it just flat-out doesn't work in the thin Client.

@dkandalov
Copy link
Owner

Hi. I never tried using LivePlugin in the thin Client, I should though! I also never tried developing a language plugin in LivePlugin (I wouldn't expect it to be super-easy to be honest 🙈).

@UnbridledGames
Copy link
Author

UnbridledGames commented Sep 12, 2022

So it DOES work - what convinced me it doesn't is adding an action does not seem to work. Either by adding to the tools menu, or activating with a hotkey. Adding an action, flat out does not work in the thin client.

But, so far I HAVE been successful in adding a CompletionContributor for yaml files. When in a string in the file, typing [blah will open an autocomplete window, with custom data. That works. Where I'm stuck is populating that custom data from info inside the YAML files in the project. I'm getting close to just making a hack version of it that uses pre-loaded text files with the data. I'd rather not, I'd love for this to be live updating.

You saying that it wouldn't be super easy is turning out to be true. I have now spent 4 hours today trying my damndest to import literally anything from org.jetbrains.yaml. No matter what I do, with or without the yaml.jar added to plugin imports, any time I try and reference ANYTHING from it I get:

Caused by: java.lang.NoClassDefFoundError: org/jetbrains/yaml/psi/YamlPsiElementVisitor
and
Caused by: java.lang.ClassNotFoundException: org.jetbrains.yaml.psi.YamlPsiElementVisitor

And this is NOT in the thin client - I'm developing it locally in IDEA til I know it works first.

Any clue why I cannot reference anything yaml related? I'm REALLY trying to avoid writing this as a normal plugin, the number of restarts I'd have to make to test the plugin would be enough for me to just quit.

ANY advice would be appreceiated.

@dkandalov
Copy link
Owner

Thank you! I didn't know there was a problem with adding actions in the thin client. I might look into it at some point.

Plugins in IntelliJ don't know about each other unless explicitly specified. You can do in LivePlugin like this https://github.com/dkandalov/live-plugin/blob/master/plugin-examples/kotlin/additional-classpath/plugin.kts or for yaml it will be // depends-on-plugin org.jetbrains.plugins.yaml.

Btw, I found yaml plugin id by opening IntelliJ source code, searching for "YamlPsiElementVisitor" and then checking id in the plugin.xml in the module where the file is defined. As a side note, it would be nice to automate this so that LivePlugin can suggest adding a plugin dependency based on missing class name.

@UnbridledGames
Copy link
Author

Thanks a ton for that hint. I added that and everything started working. On a LOCAL client my plugin works perfectly. I'm still ironing out bugs on the thin client. If you've any interest in looking into it, a few issues I've found:
The plugin.groovy file that I open through the plugins window seems to be stored locally, and in the IDE it's not even recognized as code. No highlighting, completion, nothing. IDE treats it as a text file basically. I created a pluginremote.groovy file that resides on the server, and when pasting the code in there, it highlights as normal.

Ok actually that's the biggest issue. It makes debugging/working on the code difficult. I'm sure the issues I'm having now are dependency issues.

What happens behind the scenes with // depends-on-plugin? Pretty sure the failures I'm seeing now is some inconsistency about where that plugin exists (local or remote) and how LivePlugin is looking for it. I jsut copied the yaml.jar file over to the remote machine and am gonna try adding it as a library over there. God knows what else is missing/needs to be copied over. The main project is a python app which started on the remote machine, and then I found out about Jetbrains Gateway and the thin client, so jetbrains didn't set up the enviornment, so that might be an issue on my end.

Thanks again, made major progress today.

@UnbridledGames
Copy link
Author

UnbridledGames commented Sep 13, 2022

Now a roadblock when Im trying it on the remote server:

Failed to find dependent plugin 'org.jetbrains.plugins.yaml'.

Seems that needs to be somewhere on the server side. Any idea? Gonna keep banging away at it in the meantime.

Edit: Seems I got that last issue fixed by ramming the yaml.jar file into a directory with other jars, since the Project Structure is apparently unavailable on the thin client?

Now my new error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:General error during conversion: java.lang.NoClassDefFoundError: com.intellij.openapi.vcs.VcsRootjava.lang.RuntimeException: java.lang.NoClassDefFoundError: com.intellij.openapi.vcs.VcsRoot

I'm assuming the vcs issue is in LivePlugin, as my code doesn't use that at all..? Or maybe in the yaml plugin?

This remote client is a freaking nightmare.

@dkandalov
Copy link
Owner

dkandalov commented Sep 18, 2022

Hi. Sorry the slow reply.

Just to be clear, when you're talking about "thin client" do you mean you're using https://www.jetbrains.com/code-with-me or https://lp.jetbrains.com/projector? I tried both a while ago but neither of them worked properly at the time so I lost interest but it might be worth looking again (assuming they work ok now).

What happens behind the scenes with // depends-on-plugin

LivePlugin add plugin jars and all of it transitive dependencies to the classloader which will be used for running pluin code (see https://github.com/dkandalov/live-plugin/blob/master/src/main/liveplugin/implementation/pluginrunner/kotlin/KotlinPluginRunner.kt#L55 for details 🙈)

Seems that needs to be somewhere on the server side. Any idea?
I'm assuming the vcs issue is in LivePlugin, as my code doesn't use that at all..? Or maybe in the yaml plugin?
This remote client is a freaking nightmare.

No actual idea, sorry :( It's not obvious to me what's going on and I'll have to debug it myself.
I'd try to make it all working locally first though and then try with remote client or any other setup.

@UnbridledGames
Copy link
Author

I'm using the JetBrains Gateway package. Which as I click your links it seems the Projector was rolled into Gateway.

@lukaville
Copy link

lukaville commented Aug 17, 2023

I have the same issue with

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:General error during conversion: java.lang.NoClassDefFoundError: com.intellij.openapi.vcs.VcsRootjava.lang.RuntimeException: java.lang.NoClassDefFoundError: com.intellij.openapi.vcs.VcsRoot

When I use JetBrains Gateway

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

No branches or pull requests

3 participants