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

fix 'unkown command elxir with rtx' and fish #1019

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

Whoops
Copy link
Contributor

@Whoops Whoops commented Nov 1, 2023

Currently, when I try to use elixir-ls with fish in vscode it fails to start with the following failure:

Preferred shell is fish, launching launch.fish
Looking for ASDF install
ASDF not found
Looking for rtx executable
rtx executable found in /usr/bin/rtx, activating
fish: Unknown command: elixir
./scripts/launch.fish (line 79): 
echo "" | elixir "$scriptpath/quiet_install.exs" >/dev/null || exit 1

Chasing this down a bit, RTX relies on the fish_prompt and fish_preexec to do its magic, and fish_prompt is never fired in a script, so unless vscode is launched from a shell where RTX has already set its environment variables, activating RTX won't work. Since Elixir-LS doesn't need the directory-changing magic, I think rtx env is the way to go here.

@lukaszsamson
Copy link
Collaborator

I don't know nor use fish so I'm pinging other contributors. Can you help with reviewing? @Defman21
@ForLoveOfCats @jaminthorns

@Defman21
Copy link
Contributor

Defman21 commented Nov 1, 2023

Well, rtx env is the way to use rtx only in current session (without touching user's fish configuration), which I guess is fine for the case of running elixir-ls. As long as it works both from running vscode via the terminal and UI, then LGTM.

I'll test this PR just in case and tell the results shortly.

@Defman21
Copy link
Contributor

Defman21 commented Nov 1, 2023

Running VSCode from terminal and GUI: both working fine, elixir is found and elixir-ls works! 🎉

macOS Sonoma 14

@jaminthorns
Copy link
Contributor

I've never used rtx, but upon reading through the documentation, rtx env definitely seems like the more appropriate command to use.

Given that, we should probably switch from rtx activate to rtx env in the launch.sh script as well:

eval "$($(which rtx) activate "$preferred_shell")"

@lukaszsamson If you agree, should that be done in this PR or a separate one?

@lukaszsamson lukaszsamson merged commit f5f62da into elixir-lsp:master Nov 2, 2023
@lukaszsamson
Copy link
Collaborator

Thanks all. @jaminthorns good point. I went ahead and did the change in 4894b38

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

Successfully merging this pull request may close these issues.

4 participants