Elixir package for Sublime Text 4

I’m happy to finally present to you the best Sublime Text package for Elixir, templates and more! :partying_face: :confetti_ball:

ElixirSyntax – The most powerful Elixir for the most Sublime experience.

In this latest v2.2.0 release I have added support for HEEx and Surface!

@princemaple is the original maintainer of the project. :wave:
I started making lots of contributions in 2019. Over 6 months in the making, the package has undergone a complete rewrite by me and was first released in April this year. After many more improvements and heavy polishing I decided it’s ready to be announced to the wider public.

Q&A

This is crazy good! Why did you do this?
I spend up to 7 work hours in the editor each day.
I like my tools to be finely honed in order to be efficient and to enjoy my craft.

Why use ST4 with this plugin?
It all comes down to personal preferences. My top reasons for using ST are:

  • Speed of: startup, typing, rendering, searching, plugins
  • Low memory usage
  • Git integration
  • Easy-to-use GUI

Is it perfect?
By no means, no. Neither is Sublime Text nor the package. ST4 has received great updates and a much better syntax highlighting engine is one of them. However, the engine still has limitations and some fundamental issues remain. The syntax definition language in YAML with regular expressions is also not the best possible way to define a computer language grammar.

What about the elixir-tmbundle package?
Josè based it off of a Ruby package and I think it served its purpose well. There’s a ticket on Github discussing my efforts.
I incidentally met José last week at ElixirConf and we talked about this stuff. He promised he’d try out my package soon. I hope you will now, José! :grinning_face_with_smiling_eyes:

What about alternative editors?
There are plenty and I have tried many. Even if some of them are incredible I just can’t use them for one reason or another. Mainly for the top reasons I mentioned above.
I’m following the tree-sitter project with great interest and hope that it will be combined with a great editor in the near future. I will consider switching from ST as soon as that happens (note: ST won’t be using tree-sitter). I know there are projects like NeoVim and others but nothing stable and attractive afaics.

Can I somehow highlight code for my slides?
Of course! Just select some code, open the console panel (Ctrl+`) and enter view.export_to_html(view.sel()).
I have seen so many slides with Elixir code in them and the highlighting was just not the best it could be. I hope speakers take notice and create more beautiful slides from now on in the future. :ok_hand::sunglasses:

Enjoy!

24 Likes

Looks great :+1:

The next version will be released soon so I’d like to ask users of this package and also interested newcomers to please check out my dev branch and test it for bugs and usability issues. I tried to document things quite a bit but I’m sure it can be improved still.

Any feedback is welcome and appreciated!

Highlights:

  • New snippets, builds, menus, completions, key maps, settings etc.
  • Commands for running mix test and mix format (manual & automatic). With Alt+Shift+T you can run the test at the selected line or several tests with multi-selections. Press Alt+Shift+R to repeat the previously executed tests.
  • Better parameter highlighting in function headers and in arrow clauses as in for or with statements.
  • Lots of fixes and other improvements.

Have fun!

PS:

How to install

Just copy the contents to your Packages folder. On Linux it should be ~/.config/sublime-text/Packages/ElixirSyntax/.

1 Like

Cool, didn’t know there’s an alternative elixir package. Will try it out.

How do I install the dev-branch version? :thinking:

Sorry, I assumed that people would know. Added a note to my comment above.

Played with the dev-branch for a bit.

Syntax highlighting is great. Only thing I’ve spotted is the same color for HTML data attributes and some elixir keywords.

But the more pesky thing that happened, is LSP crashing:

Is it a problem that ElixirLS was compiled with a different Elixir and Erlang? (Also, I install Elixir with asdf)

lsp-elixir: Started ElixirLS v0.11.0
lsp-elixir: Elixir version: "1.13.4 (compiled with Erlang/OTP 25)"
lsp-elixir: Erlang version: "25"
lsp-elixir: ElixirLS compiled with Elixir 1.11.4 and erlang 22

Thanks for testing it! Oh, that doesn’t really look good. So I can see you’re using the Mariana default theme. Keywords and HTML attributes seem to be coloured with the same colour. That’s something I can’t really change. :slightly_frowning_face: I mean, I have some theme overrides for Mariana and Monokai to touch up certain scopes but I don’t try to go against the main style of the theme…

LSP crashing seems to be a sign of recent updates and incompatibilities. I had to remove elixir-ls today from my package manager when the update didn’t work, so I didn’t get to see any crashes so far. But I hope everything will work once I update Erlang, Elixir and so on. Let’s see.

So it is a problem of the theme? What theme do you use?

Pretty much. If you look at normal Elixir code you see the keywords in purple, right? I guess that is the standard colour it assigns to keywords… I’m using the Monokai theme. It’s not perfect but it’s a good dark theme and gives much better contrasts than Mariana.

With Monokai Pro it is indeed better

Oh, never seen Monokai Pro before. But it is a different theme than just “Monokai” right? Looks like the overrides I wrote for the Monokai theme are not applied in your image. ~H and {property, schema} should not be italic and <%= should not be orange but grey…

Seems to be the most popular Monokai theme currently: https://monokai.pro

There are so many different Monokai variations. Do you have a link to the one you use?

Interesting, thanks for the link. The basic version is actually shipped with ST by default. No need to install anything extra…

monokai

Didn’t know that it’s included. Hope that now it is like your setup.

Yep! That’s it. Very nice. :grinning: :+1:

@aziz Running smooth so far :slight_smile: When are you releasing it?

@egze Thanks for testing it! Been busy lately and there are a few little things to do. But it should be released very soon. :grinning:

Congrats on releasing v3.0! Some excellent improvements!

1 Like

Wohoo. Installing now. Thanks!

1 Like