Skip to content

Instantly share code, notes, and snippets.

@binaryseed
Last active May 26, 2021 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save binaryseed/b8d5c7bef2627f89b3801d420be6b06a to your computer and use it in GitHub Desktop.
Save binaryseed/b8d5c7bef2627f89b3801d420be6b06a to your computer and use it in GitHub Desktop.
ST4 + Elixir LSP

Sublime Text 4 & Elixir LSP

Install packages

cd "~/Library/Application Support/Sublime Text/Packages"
git clone git@github.com:sublimelsp/LSP.git
git clone git://github.com/elixir-lang/elixir-tmbundle Elixir
  • Restart Sublime and run the command Package Control: Satisfy Dependencies to make sure everything is installed.

Install Elixir LS

  • Clone the Elixir Language Server repo and compile:
git clone git@github.com:elixir-lsp/elixir-ls.git
cd elixir-ls
mix deps.get
mix compile
mix elixir_ls.release -o release/
  • Configure LSP.sublime-settings to point to the Elixir LS "release" we just compiled:
"clients": {
  "elixir-ls": {
    "command": [
      "/ABSOLUTE_ELIXIR_LS_PATH/release/language_server.sh"
    ],
    "enabled": true,
    "languageId": "elixir",
    "scopes": [
      "source.elixir"
    ],
    "settings": {
    },
    "syntaxes": [
      "Packages/Elixir/Syntaxes/Elixir.tmLanguage"
    ]
  }
}

Configure some nice features

  • Turn on auto formatting in Preferences.sublime-settings:
"lsp_format_on_save": true,
  • Hide .beam files in Preferences.sublime-settings:
"binary_file_patterns": [
  "*.beam"
]
  • Hide un-needed directories in Preferences.sublime-settings:
"folder_exclude_patterns": [
  "deps",
  "_build",
  ".elixir_ls"
]
  • Setup ctrl+click to open function definition in Default.sublime-mousemap:
[
  {
    "button": "button1",
    "count": 1,
    "modifiers": ["ctrl"],
    "press_command": "drag_select",
    "command": "lsp_symbol_definition"
  }
]

(Use button3 for middle-click)

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