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

Doesn't work with VS Code Remote Dev Container #66

Closed
sanjibukai opened this issue Apr 5, 2020 · 13 comments
Closed

Doesn't work with VS Code Remote Dev Container #66

sanjibukai opened this issue Apr 5, 2020 · 13 comments
Labels
help wanted Extra attention is needed

Comments

@sanjibukai
Copy link

Hello,

I'm not sure if it's the right repo (vs elixir-lsp/elixir-ls) but since it's related to VS Code (with its Remote Dev Container features) I'm asking here.

Simply put, nothing happen with this extension when it's installed on the Remote Dev Container (and that the container is up and running etc.)

To contrast, if I disable (or uninstall) this extension on the container and use back the original one from jakebecker/elixir-ls), everything work out of the box.

Does this extension need something particular to set up and that I'm missing?

For example, the default installation folder when installed on a Dev Container is
~/.vscode-server/extensions rather than ~/.vscode/extensions. Could it be a problem with an harcoded path?

I have VS Code 1.43.2, Elixir 1.10, and this extension as 0.3.2

@axelson axelson added the help wanted Extra attention is needed label Apr 5, 2020
@axelson
Copy link
Member

axelson commented Apr 5, 2020

@sanjibukai yes, this is the right place to ask about this. Any help tracking down the root cause would be greatly appreciated. Although personally I don't like trying to configure docker I'm not sure when I'll take a look at this. A good first step would be to look at all the changes in this repository compared to the current master of https://github.com/JakeBecker/vscode-elixir-ls
Since there's been much less changes in this repository as compared to elixir-ls and elixir_sense if one of the changes did affect the Remote Dev Container support it should be feasible to track down. Also, what operating system are you running? I wonder if this problem affects certain operating systems more.

Although actually there are some elixir-ls PR's that come to mind and you might want to look into removing:

Does this extension need something particular to set up and that I'm missing?

No it does not

@axelson
Copy link
Member

axelson commented Apr 5, 2020

Also this is a tangentially related issue report: elixir-lsp/elixir-ls#160

@sanjibukai
Copy link
Author

sanjibukai commented Apr 5, 2020

Thanks for taking the time to answer..
I'll definitely try to dig more.. I'll look to these links..

Also, what operating system are you running?

I'm using linux (Manjaro) with everything up-to date (eg. linux 5.5.13, vscode 1.43.2, docker 19.03.8)

Edit:
I started to look at the change pointed in the first link elixir-lsp/elixir-ls@8cdc13e
And right away, I noticed that I forgot to mention what "operating system" (say base image) I'm using inside the container.. Well, I'm using an Alpine image of the Elixir Docker image which doesn't come with bash but ash!
I'm not sure if this has an impact on the shebang, but the first thing I'll do is to try with a regular image and as you said try by removing these changes..

@sanjibukai
Copy link
Author

Well.. I thought that the simplest thing I can do was simply to install bash to begin with..
And indeed it did the trick.
The extension now works!!
And if I try to execute manually the language_server.sh I got bash not found, so TIL that the shebang is strict with the shell variant provided.
And when I put back sh instead of bash in the shebang, it works too (without having bash installed in the container)!

So in the meantime I'll simply add bash in my Dockerfile (not a big deal) so that I don't have to change the extension code etc.

But would you mind if I ask why you went with a change that added restrictions?
I mean bash is a restriction of ash which is a restriction of sh.. So why not leave more generalized options when it's possible?

NB: Also, I permit myself to ask if this issue can be taken into account in a future version?

@axelson
Copy link
Member

axelson commented Apr 6, 2020

@sanjibukai The problem which /bin/sh is that it breaks support for Ubuntu, here's the forum post from David Sweeney reporting that: https://elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/157

The reason it breaks is because asdf does not support sh: asdf-vm/asdf#653

asdf only supports: bash, fish, zsh

I'm actually a little surprised that ash works when dash does not since it seems like they both aim for sh compatibility. Is there an environment variable that indicates that language_server.sh is running inside a container? Maybe that could be used to drop the asdf invocation since I would guess that most containers are only running a single version of elixir and erlang.

@sanjibukai
Copy link
Author

I did't even know what's asdf (looked now), but I don't have that inside the container and indeed it's not a tool that makes sense within a container.
I guess that this line [ -f "$HOME/.asdf/asdf.sh" ] && . "$HOME/.asdf/asdf.sh" simply don't succeed so I guess that it's not mandatory to have it..

@axelson
Copy link
Member

axelson commented Apr 8, 2020

@sanjibukai can you test elixir-lsp/elixir-ls#190? It changes the default shell script to launch with #/bin/sh which should work with alpine.

@ndarilek
Copy link

Having this same issue. Running in a Debian container that has Bash installed, and the extension won't start. I'm fairly new to VSCode. How do I debug situations where an extension doesn't start? Should there be a log somewhere?

@axelson
Copy link
Member

axelson commented Apr 20, 2020

@ndarilek Here are the troubleshooting instructions. Please provide some of the info because it will help in tracking this down:

Environment

Most of this can be filled out by running the VSCode command (by default bound to Ctrl+Shift+P) "ElixirLS Fork: Copy Debug Info"

  • Elixir & Erlang versions (elixir --version):
  • VSCode ElixirLS Fork version:
  • Operating System Version:
  • If using VSCode, are you using "ElixirLS Fork: Elixir support and debugger" (note that it has "Fork" in the name)?

Troubleshooting

  • Restart your editor (which will restart ElixirLS) sometimes fixes issues
  • Stop your editor, remove the entire .elixir_ls directory, then restart your editor
    • NOTE: This will cause you to have to re-run the entire dialyzer build

Crash report template

Delete this section if not reporting a crash

  1. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? If not, please publish a repo on Github that does reproduce it.
  2. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
  3. Check the developer console by opening Help > Toggle Developer Tools and include any errors that look relevant.

@axelson
Copy link
Member

axelson commented Apr 22, 2020

@ndarilek you're problem sounds fairly similar to elixir-lsp/elixir-ls#208 perhaps you also have an incomplete Erlang installation? What operating system are you on and how did you install elixir and erlang?

@sanjibukai can you try version 0.3.3 https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls (you might have to uninstall the "fork" version now that the fork is reconciled)

@ndarilek
Copy link

ndarilek commented Apr 22, 2020 via email

@ndarilek
Copy link

ndarilek commented Apr 22, 2020 via email

@axelson
Copy link
Member

axelson commented Apr 22, 2020

Yeah, I still need to take care of elixir-lsp/elixir-ls#212 😅

I'm glad that you got it working smoothly now!

I'm going to go ahead and mark this closed from a combination of elixir-lsp/elixir-ls#190 and the fix first reported in elixir-lsp/elixir-ls#208

@sanjibukai if you're still running into issues, please file a new issue :)

@axelson axelson closed this as completed Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants