Skip to content

Instantly share code, notes, and snippets.

@florinpatrascu
Last active March 16, 2019 11:45
Show Gist options
  • Save florinpatrascu/3168f1cb314423743c844bee664cc468 to your computer and use it in GitHub Desktop.
Save florinpatrascu/3168f1cb314423743c844bee664cc468 to your computer and use it in GitHub Desktop.
Experimenting with the Universal Language Server support for Sublime Text 3 plugin and Elixir, using the Language Server Protocol.

Sublime3, LSP and Elixir - notes

Experimenting with the Universal Language Server support for Sublime Text 3 plugin, available here and Elixir, using the Language Server Protocol.

Right now, and sadly, the LSP plugin doesn't include Elixir out of the box. A bit of copying some files around and editing, is still required. I am focusing on OSX only, in this note.

Prerequisites

Install the following:

Setup

First make sure you have Elixir, Sublime3 and the plugins above, properly installed. Then edit the following file: ~/Library/Application Support/Sublime\ Text\ 3/Packages/LSP/LSP.sublime-settings, and add the following entry, to the {"clients": { .. structure:

"elixir":
  {
    "command": ["elixir"],
    "scopes": ["source.ex", "source.exs"],
    "syntaxes": ["Packages/elixir-tmbundle/Syntaxes/Elixir.tmLanguage", "Packages/elixir-tmbundle/Syntaxes/EEx.tmLanguage", "Packages/elixir-tmbundle/Syntaxes/HTML (EEx).tmLanguage"],
    "languageId": "elixir"
  }

That's all. If while you edit the LSP.sublime-settings file, your Sublime console is open (CTRL ~), you can see the support for Elixir loading and be available for immediate use, excerpt:

LSP: Config added: clangd (enabled)
LSP: Config added: rls (enabled)
LSP: Config added: reason (enabled)
LSP: Config added: elixir (enabled)
LSP: Config added: pyls (enabled)
LSP: Config added: jsts (enabled)
LSP: Config added: dotty (enabled)
LSP: Config added: golsp (enabled)
LSP: Config added: ocaml (enabled)

Caveats

  • all this work can be scripted, but I am lazy :P
  • the inline Elixir doc doesn't have a nice formatter, it will be hard to read, but it works

HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment