Helix editor for Elixir Development

added…to config.toml [keys.normal] section

[keys.normal]
esc = ["collapse_selection", "keep_primary_selection"]
ret = ["move_line_down", "goto_first_nonwhitespace"]
0   = "goto_line_start"
C-s = ":w" # Save files with Ctrl+S (not sure what that would be on Macs)
C-o = ":open ~/.config/helix/config.toml" # Ctrl+O to open the config
g = { a = "code_action" } # ga to open code actions
X = "extend_line_above" # Shift+x to select the whole line above
D = ["goto_first_nonwhitespace", "extend_to_line_end", "change_selection"] # Wipe and edit the current line
c = ["trim_selections", "change_selection"] # Make 'c' automatically strip the selection of extra whitespace
a = ["append_mode", "collapse_selection"] # Remove the selection when entering insert mode with 'a'
"tab" = "goto_next_function" # Select and jump to the next function via Treesitter
"S-tab" = "goto_prev_function" # Select and jump to the previous function via Treesitter

thanks

I did find a link to adding ElixiLS from source yesterday but I have so many tabs open its got lost - I will find it somewhere…

There are also prebuilt binaries available at Releases · elixir-lsp/elixir-ls · GitHub. But do note that once you either compile one yourself or download a prebuilt one, you will end up with a .sh launcher which you will need to create a symlink for and make sure this symlink is available in your path. For example, I downloaded a prebuilt release and put the zip contents into ~/.local/share/elixirls, then created a symlink to ~/.local/share/elixirls/language_server.sh and put it into ~/.local/bin (which is in my $PATH).

I installed it and went over the tutor. Didn’t try it on a project yet. So far it looks good. Never heard of this editor so thanks for the post!

1 Like

BTW there’s also a “Helix mode” extension for VS code. I’ve just tried it and it’s surprisingly good, the only flaw I noticed so far is deleting the wrong bracket pairs upon typing md(. Good to know because I really needed to combine the wide reach of VSC plugins and ergonomics of Helix (vim feels painful for me).

1 Like

I always get Async job failed , it did work once but never again right now it works for ruby and docker in my env but for elixir it fails even though I can run elixis-ls from cli or using sh in helix but the lsp doesn’t work in editor. Anyone else seen this issue ?

image
image

image
image

I always wanted to try helix, I come from 15 years of vim and 1 year of neovim.
Are you using exclusively helix or are you switching between the two?
I fear I can’t really learn helix if I still use vim most of the time…

There’s no need to worry, they are all pattern-based editors and I think it’s very easy to switch to Helix.

My current situation is that I still switch between the two because the PR for Helix’s file tree hasn’t been merged yet, and sometimes it’s not convenient for me to browse the file structure in Helix.

I haven’t met that, but I believe we can try to add timeout in .config/helix/languages.toml
https://docs.helix-editor.com/languages.html

[[language-server]]
timeout = 30

I noticed that the syntax highlighting for HEEX files was not correct with just adding “heex” to the file types but adding “html.heex” did the trick for me:

[[language]]
name = “elixir”
scope = “source.elixir”
injection-regex = “elixir”
file-types = [“ex”, “exs”, “html.heex”]
roots = [“mix.exs”]
auto-format = true
diagnostic-severity = “Hint”
comment-token = “#”
indent = {tab-width = 2, unit = " "}
language-server = {command = “elixir-ls”}

3 Likes

I noted that after installing on a system that I had not been doing elixir development on, I had to run the language server executable directly to clear the Y/N questions it was asking before it would work with Helix.

I also want to run elixir in helix. But for me its working.

I notice that hx/elixir-ls work in elixir 1.14, because that’s the version i compiled elixir-ls with on ubuntu, but it does not work with elixir 1.13. Anyone know how to deal with that?

I too couldn’t make elixir-ls work even though I followed the installation steps correctly, what solved it for me was starting elixir-ls from the command line and installing Hex (or whatever dependency it prompted to install).

Hey Helix users :slight_smile: I am trying Helix, but I miss shortcuts to run the tests for one of these:

  • the line my cursor is currently on (mix test path/to/the/file.exs:line_number)
  • the file I have currently open and active (mix test path/to/file.exs)
  • everything (mix test)

Do you have an idea if this is even possible in Helix?

1 Like

It looks like it could be done with an approach like this: Helix and tmux integration - DEV Community

Are you guys enjoying Helix?

To me, it served me as a stepping stone into neovim.

Having total control of your IDE is amazing. There’s nothing in particular that would make someone jump from vscode, but it’s just the volume of tiny optimizations that makes it awesome.

I’ve actually switched over from neovim. I like the movement patterns better and not having to have to configure everything is great as well.
I’m using it in combination with https://zellij.dev/ and use similar things like that for testing.

For elixir most things work great. The only issue is that I haven’t got the tailwind integration with elixir working.

1 Like

I once took a class on Korean and the teacher said we were lucky in Spanish because we could start saying to the waitress

I want aaaaaa

And then, after thinking about it, say “coke”. The needed (I guess they still do), start with the subject.

That’s something I think helix got right. Start with the subject, you can visualize it, and then perform the action.

da” is an act of faith in vim, but once you truly believe in it, you can see the light

2 Likes

Did anyone figured out how to configure Helix to run ElixirLS debug adapter? Helix added support and looking at Helix editor for Elixir Development - #32 by darnahsan hx --health checks if DAP is working