aziz

aziz

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!

Showing Posts 41 to 32

aziz

aziz OP

You’re welcome, @distefam!

It’s a shame that Zed has this text rendering issue on LoDPI screens. It doesn’t really seem that bad on my external monitor. The text could certainly be sharper, but it’s almost unnoticeable.

I’ve successfully avoided VSCode the whole time, so I hope Zed will not go down a similar road. I think they do place importance on keeping things lean, tidy and fast. There are already some complex features like the AI assistant or Collaboration, but I think they don’t get in your way at all.

I didn’t think it possible so soon but I’m already using Zed daily for work. Of course, it’s not as polished as ST but the ability to properly select syntax nodes alone along with other nice things is enough to make me happy and tolerate minor annoyances. :relieved:

distefam

distefam

Thanks for the update, @aziz. I’m still sticking with SublimeText for now and this is much appreciated. I, too, have been eyeing Zed. Unfortunately, Zed has an issue that makes it completely unusable for me. And, my concern about Zed is that it might become the next VS Code in terms of clutter and lack of focus. I still prefer SublimeText for this reason, but I do agree that the community surrounding it, including package development, seems to have waned. I’ve still yet to find an editor that gets out of my way as much as possible as Sublime, but hoping that Zed can resist the siren call of becoming too complex.

aziz

aziz OP

Hey, everyone! I can finally announce version 4 of this plugin:

However, I’d also like to inform you that this will be the last version I’m going to release, except perhaps for minor bug-fix releases.

ST has served me well over the years, but I’m excited about Zed and plan on switching to it completely eventually. Zed isn’t quite there yet, but it’s in active development and becoming more and more usable with each release. Some of the reasons I wish to switch to Zed are:

  • ST’s syntax highlighting “technology” is a dead-end and absolutely no fun to work with (I actually feel burnt out now when I look at it).
  • Zed is pretty much on par with ST when it comes to speed and memory consumption.
  • Updates for ST are too infrequent and don’t bring any cool noticeable improvements like I’ve seen in Zed.
  • Longstanding annoying issues aren’t fixed. They are minor but maddening when they happen, like randomly not being able to comment out code with a shortcut anymore. Or when switching from file to project search, it messes up the search text. And then the search history itself is often confusing to me. I just don’t want to report bugs anymore. I feel they will go under and not be fixed for ages to come.
  • My favourite is when I format the current file with a shortcut that calls mix format, ST loves to just jump up several pages. (It seems this is affected by how many files are open.)
  • The search results view sucks. In Zed the results are syntax highlighted and you can even edit the code right there!
  • ST isn’t good at providing features that depend on the existence of a proper syntax tree. Like increasing the selection to a larger syntax node. While it works in simple cases, try expanding the selection to an HTML attribute value and then further to include the name…

Anyway, I hope the plugin has been useful to many developers so far and wish you continued happy and productive coding with the tool of your choice! :smile:

aziz

aziz OP

Hi, @distefam! That’s interesting! Thanks for pointing this out. I’ve been checking out what the plugin is capable of, but I’m not sure how it could join forces with ST. Sublime’s syntax engine isn’t really controllable through Python code. You can add individual text regions with styles on top of the already highlighted code, but it would be crazy inefficient and slow to highlight views solely with TreeSitter’s AST info and ST API calls to add_regions(). I imagine the plugin could be useful for code navigation or listing symbols, but then again LSP-elixir and ST already do that (for better or worse.)

It isn’t really meaningful to adapt ElixirSyntax because ST syntax definitions (YAML files with stacked regular expressions) and TreeSitter grammars are different technologies. The only thing I believe would make sense is if ST ditched its engine and replaced it with TreeSitter entirely. But as I mentioned in my original posting, judging from an exchange on GitHub that’s probably not gonna happen. Who knows, maybe it will happen when TreeSitter editors start leaving ST in the dust, but for me there isn’t one out there yet that does it for me.

I’ll continue looking into this. It’s new and definitely exciting. :+1:

distefam

distefam

@aziz Now that there is a TreeSitter plugin for SublimeText, would it be possible to update/simplify ElixirSyntax to work with its definitions for nodes rather than the scopes provided by SublimeText? It might be that I’m not understanding what is possible with the API provided by the TreeSitter plugin though and that it might not be possible to develop a color scheme based on it for SublimeText.

aziz

aziz OP

Hey, no worries. Enjoy developing with ElixirSyntax! :grinning:

abar

abar

Hi aziz, sorry, my bad. In the process of recording a screencast for freezes, I have noticed that I have ElixirSublime package activated too.

Disabling it fixed the issue, now everything works as expected. My apologies for the distraction :upside_down_face:

aziz

aziz OP

Hi, abar!

That’s rather strange. I couldn’t reproduce the freezes using your examples. Maybe the set of plugins you have installed may cause negative interactions? Do you still have the Elixir plugin installed?

Please share your list of plugins if you don’t mind. :+1:

Also: can you make out what exactly spikes the CPU using htop?

abar

abar

Hi everyone, just wanted to ask, if anyone else has freezes with ElixirSyntax?

I’m using it with Sublime Text 4 to edit a phoenix project (while mix phx.server is on), but even in a simple cases I get freezes that may last up to 2 seconds.

One example: defp format(n), do: n, as I typed do: editor froze, had to wait a few seconds to see n. Another example: typing @constant [] gives a freeze.

And it’s not exclusive to typing, sometimes freezing occurs even if when I use backspace and delete whitespaces, for example.

It didn’t happen with any other plugins, and disabling ElixirSyntax seems to fix the issue. “I use arch btw” if that’s relevant.

I tried to change output_scroll_time in settings, but it changed nothing.

Apart from that it is a great plugin, and I love the .heex file support - so I would like to see if there’s a way to get it working without those disruptive interruptions.

aziz

aziz OP

Hey! Those snippets are coming from elixir-ls and the LSP-elixir plugin. I don’t know if they are customizable, but as a work-around you can easily create snippets yourself:

Store this XML text in Packages/User/Kernel.def.sublime-snippet:

<snippet>
  <content><![CDATA[def $1($2) do
end]]></content>
  <tabTrigger>def</tabTrigger>
  <scope>source.elixir</scope>
  <description>Kernel.def/2</description>
</snippet>

Where Next? Top

Trending in Dev Env & Tools Top

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews