-
Notifications
You must be signed in to change notification settings - Fork 50
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
Path mapping to support "Go to detention" inside Docker #59
Comments
Interesting setup. Can you maybe open up the developer console in vscode (via the "Help" menu) and try a few go to definitions and make a screenshot / copy of the log output? An example docker-compose file may also be of interested so that i am able to reproduce the use case. |
I am so glad you are interested :) I have created a test repo with minimalistic MIX app https://github.com/iJackUA/vscode-elixir-docker-test As for DevTool console, here is output I can trace (with those test project) On Host machine (Hover + Cmd + Click redirects to correct Definition)
On Docker (Hover + Cmd + Click DOES NOT redirects to Definition)
|
I am not experienced in VSCode extensions development, but locally I did a proof of concept "hack" in https://github.com/fr1zle/vscode-elixir/blob/bffea3539ccfd605dfc62729551d86fd886ba153/alchemist-server/lib/api/defl.exs#L118 Added string replace
And now in my test project it seems that Go to definition works in both cases with local compile and Docker compile. But this solution requires a maintainer love :) |
Hint for this who struggle because of the same issue.
Just set you paths. Now VSCode while trying to access source codes in /www folder get forwarded to real sources via symlink and all Go to Definiton request now works as expected (and yes you will need to recreate symlink for each project or create a set of unique folder names). |
@iJackUA your autocomplete is working with this setup? I have a phoenix project inside a docker and the VSCode in my host machine. But the autocomplete doesn't work for me. |
@lypborges yes, autocomplete still works for me |
Is it possible somehow to specify path mapping between container FS and Host FS?
Because currently if I develop locally using Docker containers Erlang/Elixir by itself and my source code are placed inside the container.
VSCode is installed on my host machine (not inside the container).
_build
folder and.beam
files are exposed via FS sharing to host.So VSCode can see
.beam
and I suppose that allows Autocompletion - stdlib modules and my code is autocompleted by VSCode. But Go to definition does not work.I suppose it because the internal of
.beam
files that have path information according to Docker container root folders, but VSCode attempts to find the same path on my Host machine.For example Ecto module in
iex
inside the elixir 1.4 docker imageand my local host machine Elixir installation shows
Also I suppose that
/www
is because myworking_dir
in docker-compose is set to/www
. And it is saved after compilation.I am not sure I investigated in correct direction, but maybe it possible to specify (in extension settings) this "path prefix" to do correct path resolution on the host machine ?
The text was updated successfully, but these errors were encountered: