Elixir editing on KDE's Kate editor (with elixir-ls integration)

Hey there people :slight_smile:

Just wanted to share a very quick and easy setup for editing Elixir in KDE’s Kate editor. This is a very nice and simple editor. It starts real fast and is quite easy on memory and cpu.

Here is a screenshot of it working with elixir-ls and syntax highlighting:

To configure it is very easy:

  • Open up settings → Configure Kate
  • Plugins → enable LSP Client plugin apply and restart Kate
  • Open up settings once again → Configure Kate → LSP Client
  • Under the tab of User Server Settings add this snippet (you need to have cloned elixir-ls and ran its build first):
{
    "servers": {
        "elixir-ls": {
            "command": ["FULL PATH TO YOUR language_server.sh FILE"],
            "rootIndicationFileNames": ["mix.exs"],            
            "url": "https://github.com/elixir-lsp/elixir-ls",
            "highlightingModeRegex": "^(Elixir)$"
        }
    }
}
  • Restart kate
  • Open any Elixir project (should start the LSP automatically)
  • Make sure you configure your project going to: Tools → Mode → Sources → Elixir

That’s it :slight_smile:

What I’ve tested:

  • Auto-complete
  • Code formatting (although couldn’t find a way to trigger format on save)
  • Go to definition

I don’t use it on a daily basis, but it is an awesome fully open source alternative to add in the mix. Auto-completion, code formatting and all working fine with just these settings. I am an Emacs user but its nice to have an alternative that is native to my DE.

For those interested, here are some links:

Anyway, just wanted to share this little snippet. I’ve seen some other KDE fans around here so that might make em happy too.

12 Likes

Lexical works fine too…

In general I like how much apps KDE/Plasma have, but …

  1. They have 2 editors (kate and kwrite)
  2. Modern code editor is pretty specific topic, a good editor like kate cannot be compared to editors like zed which are very specialised in terms of performance (including UI rendering on GPU)

As above both editors are good, but most likely for new developers that want to have a same UI style for all apps. A senior developers would rather choose an IDE or an editor on which maintainers are fully focused. Therefore currently Sublime Text 4 looks best (in terms of performance), but VS Code have also it’s place. A song of future (near future) is zed. I believe that the potential of it is not yet fully used, but even now it’s a powerful tool much better than a “typical” DE editor with plugin support.

It does not really matter. The point is how fast it’s at runtime. Before zed I was testing lots of editors and IDEs checking how long they need to load a project with a huge JSON database (at that time I was using HDD). The only one who really passed it was Sublime Text 3 (at that time there was no version 4). In some other cases editors often had a problem with freezing UI (that’s why I was so interested in zed before even they have started to support Linux).

If not now then I believe that zed would not have a worth opponents in at least few years as most editors are using an existing GTK+ / Qt API, so rewriting them is not so easy.

I had quite some problems getting this to run on a Mac with asdf. The elixir-ls launch script could not find asdf when ran inside Kate, because ASDF_DIR was pointing to my home directory, while asdf was installed with Homebrew.
In the end I re-installed asdf using “the preferred method” (using Git) and things are working fine now.