KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.84k stars 154 forks source link

Docker remote SDK #696

Open PhillippOhlandt opened 7 years ago

PhillippOhlandt commented 7 years ago

Hey,

I am using docker to run elixir code and tools and therefore I don't have any executables for it. The problem is that I can't remove the yellow warning. It would be nice if we could hide that somehow.

KronicDeth commented 7 years ago

My plugin doesn't control that warning. It's something built into JetBrains OpenAPI's Project code.

Also, since v5.0.0 the plugin has been able to decompile the .beam files to allow Go To Definition and Completion to work for the Elixir standard library and any Erlang dependencies that have .beam files built, such as idna, which is a dependency in a lot of Phoenix projects. Without an SDK you're losing out on those features.

Finally, how parts of the plugin work is based on the version of Elixir in the SDK. If you don't set one, it will assume a version, which may not match what you're actually using.

There's probably someway to do remote SDKs since Rubymine has support for remote Ruby SDKs. It just depends if it's part of OpenAPI or something custom, that's hard to replicate.

KronicDeth commented 7 years ago

Hmm, it looks like Docker remote SDK was added in 2017.1 RC1, so it is a very new feature. I'm not seeing the equivalent thing for JDK in IntelliJ, which would appear in OpenAPI in intellij-community where I can base support on it. Probably means I'd need to debug and reverse engineer it from Rubymine.

PhillippOhlandt commented 7 years ago

Just in case you are interested in my setup. I have the following in my .bash_profile:

function elixir() {
  docker run --rm -it -v "$(pwd)":/usr/src/app -w /usr/src/app elixir elixir "$@"
}

function iex() {
  docker run --rm -it -v "$(pwd)":/usr/src/app -w /usr/src/app elixir iex "$@"
}

function elixirc() {
  docker run --rm -it -v "$(pwd)":/usr/src/app -w /usr/src/app elixir elixirc "$@"
}

function mix() {
  docker run --rm -it -v "$(pwd)":/usr/src/app -w /usr/src/app elixir mix "$@"
}

This allows me to use it like real local binaries.

KronicDeth commented 7 years ago

What's your host and guest operating system? Would it be possible mount the guest file system in the host?

PhillippOhlandt commented 7 years ago

I am on Mac and the container will be normal Linux I think. And no, as far as I know docker, you can only mount one way. Also it wouldn't solve the SDK problem because the container isn't always running.

KronicDeth commented 7 years ago

Well, unless I'm missing something about how the Rubymine Docker Remote SDK works, it probably requires the docker container to be up in the background and it's using SSH to scan the filesystem into the VirtualFileSystem (VFS) system that JetBrains IDES use (it's the layer that allows you to peer inside jars without unpacking them for Java and also why sometimes you need to Right-click and Synchronize). Maybe it has some caching to make the container be up once and then just trust the SDK is not changing by putting it down right away.

PhillippOhlandt commented 7 years ago

So, what do you suggest now? Of course, I could just install it locally and I am pretty sure I will at some point but I think it would also be nice for the plugin to work with docker-only setups.

KronicDeth commented 7 years ago

Well, the only work-around for now is the have Elixir locally on the host so you can pick an SDK to make the warning disappear.

Adding Docker support since it it involve debugging and reverse-engineering's going to take awhile and this feature goes to the back of the queue for Enhancements unless a bunch of users start upvoting it.

PhillippOhlandt commented 7 years ago

Yeah, I saw that coming :D

Well, thanks that you will at least dig into it when you get some time :)

sascha-wolf commented 7 years ago

I assume this would also be necessary to allow for remote debugging in a docker container?

KronicDeth commented 7 years ago

@Zeeker yes, because the debugger is a mix task that opens a port, so the debugger resource files would have to be added into the docker container and then run, which means the SDK in the container needs to be known into addition the ability to "install" the debugger in a location other than where the plugin keeps its resource files by default. You probably should open a new issue, so that remote debugging can be tracked separately.

sascha-wolf commented 7 years ago

Done: #722