Skip to content

Latest commit

 

History

History
950 lines (703 loc) · 29.8 KB

language_servers.md

File metadata and controls

950 lines (703 loc) · 29.8 KB

Language Servers

Follow the setup steps for a language server to get it up and running.

If you encounter problems, consult the common issues page or search the LSP issues before opening new ones.

If there are no setup steps for a language server on this page, but a language server implementation exist, follow the guide for creating a client configuration. Pull requests for adding a new client configuration are welcome.

!!! tip "We recommend installing LSP-json." LSP-json provides completions and diagnostics when editing JSON files that adhere to a JSON schema.

!!! info "For legacy ST3 docs, see lsp.readthedocs.io."

Angular

Follow installation instructions on LSP-angular.

Assembly

  1. Install asm-lsp via Cargo (see github:bergercookie/asm-lsp):

    cargo install asm-lsp
  2. Install the x86 and x86_64 Assembly package from Package Control.

  3. Open Preferences > Package Settings > LSP > Settings and add the "asm-lsp" client configuration to the "clients":

    {
        "clients": {
            "asm-lsp": {
                "enabled": true,
                "command": ["asm-lsp"],
                "selector": "source.asm | source.assembly"
            }
        }
    }

Bash

Follow installation instructions on LSP-bash.

Also see Shell.

Bicep

Follow installation instructions on LSP-Bicep.

C/C++

Follow installation instructions on LSP-clangd.

C#

Follow installation instructions on LSP-OmniSharp.

Clojure

  1. Download clojure-lsp.

  2. Open Preferences > Package Settings > LSP > Settings and add the "clojure-lsp" client configuration to the "clients":

    {
        "clients": {
            "clojure-lsp": {
                "enabled": true,
                "command": ["/PATH/TO/clojure-lsp"], // Update the PATH
                "selector": "source.clojure",
                "initializationOptions": {}
            }
        }
    }

!!! info "See available initializationOptions."

CSS

Follow installation instructions on LSP-css.

D

  1. Install the D Language Server.

  2. Open Preferences > Package Settings > LSP > Settings and add the "serve-d" client configuration to the "clients":

    {
        "clients": {
            "serve-d": {
                "enabled": true,
                "command": ["C:/Users/MY_NAME_HERE/AppData/Roaming/code-d/bin/serve-d.exe"],
                "selector": "source.d",
                "settings": {
                    "d.dcdServerPath": "C:/Users/MY_NAME_HERE/AppData/Roaming/code-d/bin/dcd-server.exe",
                    "d.dcdClientPath": "C:/Users/MY_NAME_HERE/AppData/Roaming/code-d/bin/dcd-client.exe",
                }
            }
        }
    }

Dart

Follow installation instructions on LSP-Dart.

Dockerfile

Follow installation instructions on LSP-dockerfile.

Elixir

Follow installation instructions on LSP-elixir.

Elm

Follow installation instructions on LSP-elm.

Erlang

  1. Install the Erlang Language Server.

  2. Open Preferences > Package Settings > LSP > Settings and add the "erlang-ls" client configuration to the "clients":

    {
        "clients": {
            "erlang-ls": {
                "enabled": true,
                "command": [ "/PATH/TO/erlang_ls", "--transport", "stdio" ], // Update the PATH
                "selector": "source.erlang"
            }
        }
    }

F#

  1. Install the F# package from Package Control for syntax highlighting.

  2. Make sure you have installed the latest .NET SDK.

  3. Install the FsAutoComplete from command prompt using the following command:

    dotnet tool install --global fsautocomplete
    
  4. Open Preferences > Package Settings > LSP > Settings and add the "fsautocomplete" client configuration to the "clients":

    {
        "clients": {
            "fsautocomplete": {
                "enabled": true,
                "command": ["fsautocomplete"],
                "selector": "source.fsharp",
                "initializationOptions": {
                    "AutomaticWorkspaceInit": true
                }
            }
        }
    }

!!! info "A note about .NET Tools and $PATH" If the fsautocomplete executable isn't on your $PATH after installing it globally, ensure the .NET global tools location (by default $HOME/.dotnet/tools) is on your $PATH.

Fortran

  1. Install the ModernFortran or the Fortran package from Package Control for syntax highlighting.

  2. Install the fortls language server.

  3. Open Preferences > Package Settings > LSP > Settings and add the "fortls" client configuration to the "clients":

    {
        "clients": {
            "fortls": {
                "enabled": true,
                "command": ["fortls", "--notify_init"],
                "selector": "source.fortran | source.modern-fortran | source.fixedform-fortran"
            }
        }
    }

!!! info "See available configuration options."

Go

Follow installation instructions on LSP-gopls.

!!! info "Visit gopls repo for more info." Enable multi-module workspace support by setting the experimentalWorkspaceModule to true. Most features will work across modules, but some, such as goimports, will not work as expected. Please note that this setting is still very experimental.

GDScript (Godot Engine)

  1. Install the GDScript (Godot Engine) package from Package Control for syntax highlighting.

  2. Launch the Godot Editor on the project you are working on and leave it running.

  3. Open Preferences > Package Settings > LSP > Settings and add the "godot-lsp" client configuration to the "clients":

    {
        "clients": {
            "godot-lsp": {
                "enabled": true,
                "command": ["/PATH/TO/godot-editor.exe"], // Update the PATH
                "tcp_port": 6005, // Older versions of Godot(3.x) use port 6008
                "selector": "source.gdscript",
            }
        }
    }

If you encounter high cpu load or any other issues you can try omitting the [command] line, and ensure the godot editor is running while you work in sublime.

GraphQL

Follow installation instructions on LSP-graphql.

Haskell

  1. Install haskell-language-server.

  2. Open Preferences > Package Settings > LSP > Settings and add the "haskell-language-server" client configuration to the "clients":

    {
        "clients": {
            "haskell-language-server": {
                "enabled": true,
                "command": ["haskell-language-server-wrapper", "--lsp"],
                "selector": "source.haskell"
            }
        }
    }

HTML

Follow installation instructions on LSP-html.

Java

Follow installation instructions on LSP-jdtls.

JavaScript/TypeScript

See also Vue.

There are multiple options:

Biome

Follow installation instructions on LSP-biome.

Deno

Follow installation instructions on LSP-Deno.

ESLint

Follow installation instructions on LSP-eslint.

Flow

Follow installation instructions on LSP-flow.

quick-lint-js

  1. Install the quick-lint-js LSP server for JavaScript.

  2. Open Preferences > Package Settings > LSP > Settings and add the "quick-lint-js" client configuration to the "clients":

    {
        "clients": {
            "quick-lint-js": {
                "command": ["quick-lint-js", "--lsp-server"],
                "enabled": true,
                "selector": "source.js"
            }
        }
    }

TypeScript Language Server

Follow installation instructions on LSP-typescript.

JSON

Follow installation instructions on LSP-json.

Julia

Follow installation instructions on LSP-julia.

Kotlin

  1. Install the Kotlin package from Package Control for syntax highlighting.

  2. Install the Kotlin Language Server (requires building first).

  3. Open Preferences > Package Settings > LSP > Settings and add the "kotlinls" client configuration to the "clients":

    {
        "clients": {
            "kotlinls": {
                "enabled": true,
                "command": ["PATH/TO/KotlinLanguageServer/build/install/kotlin-language-server/bin/kotlin-language-server.bat"], // Update the PATH
                "selector": "source.Kotlin",
                "settings": {
                    "kotlin": {
                        // put your server settings here
                    }
                }
            }
        }
    }

LaTeX

TexLab

Follow installation instructions on LSP-TexLab.

LTeX

Spell check can be provided by LSP-ltex-ls.

Digestif

  1. Follow installation instructions for Digestif to install the server, and make sure it is available in your PATH.

  2. Open Preferences > Package Settings > LSP > Settings and add the "digestif" client configuration to the "clients":

    {
        "clients": {
            "digestif": {
                "enabled": true,
                "command": ["digestif"],
                "selector": "text.tex.latex"
            }
        }
    }
  3. To enable auto-completions for the relevant situations in LaTeX files, adjust Sublime's "auto_complete_selector" setting (Preferences > Settings); for example

    {
        "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc, text.tex constant.other.citation, text.tex constant.other.reference, text.tex support.function, text.tex variable.parameter.function",
    }

Lisp

  1. Install cc-lsp using Roswell.

  2. Open Preferences > Package Settings > LSP > Settings and add the "cc-lsp" client configuration to the "clients":

    {
        "clients": {
            "cc-lsp": {
                "enabled": true,
                "command": ["cl-lsp", "stdio"],
                "selector": "source.lisp"
            }
        }
    }

Leo

Follow installation instructions on LSP-leo.

Lua

Follow installation instructions on LSP-lua.

Markdown

Spell check can be provided by LSP-ltex-ls.

markmark

Markmark is a language server for Markdown files, supporting go to definition / references and more.

  1. Install Markmark (requires Node >= 16)

  2. Open Preferences > Package Settings > LSP > Settings and add the "markmark" client configuration to the "clients":

    {
        "clients": {
            "markmark": {
                "enabled": true,
                "command": ["markmark-lsp", "--stdio"],
                "selector": "text.html.markdown"
            }
        }
    }

OCaml/Reason

  1. Install the Reason package from Package Control for syntax highlighting.

  2. Install the Reason Language Server.

  3. Open Preferences > Package Settings > LSP > Settings and add the "reason" client configuration to the "clients":

    {
        "clients": {
            "reason": {
                "enabled": true,
                "command": ["PATH/TO/reason-language-server.exe"], // Update the PATH
                "selector": "source.ocaml | source.reason"
            }
        }
    }

Odin

Follow installation instructions on ols.

PromQL

Follow installation instructions on LSP-promql.

PHP

There are multiple options:

Intelephense

Follow installation instructions on LSP-intelephense.

Phpactor

  1. Install Phpactor globally.

  2. Open Preferences > Package Settings > LSP > Settings and add the "phpactor" client configuration to the "clients":

    {
        "clients": {
            "phpactor": {
                "enabled": true,
                "command": ["PATH/TO/phpactor", "language-server"],
                "selector": "embedding.php",
                "priority_selector": "source.php",
            }
        }
    }

PowerShell

Follow installation instructions on LSP-PowerShellEditorServices.

Python

There are multiple options:

Pyright

A full-featured, standards-based static type checker for Python. It is designed for high performance and can be used with large Python source bases.

Follow installation instructions on LSP-pyright.

Python LSP Server (pylsp)

A Jedi-powered language server that also supports running various linters through built-in plugins.

Follow installation instructions on LSP-pylsp.

LSP-ruff

An extremely fast Python linter and code transformation tool, written in Rust.

Follow installation instructions on LSP-ruff.

R

Follow installation instructions on R-IDE.

Racket

  1. Install the Racket package from Package Control for syntax highlighting.
  2. Follow the instructions for installation at racket-langserver.
  3. Open Preferences > Package Settings > LSP > Settings and add the "racket-langserver" client configuration to the "clients":
{
    "clients": {
        "racket-langserver": {
            "enabled": true,
            "command": ["racket", "-l", "racket-langserver"],
            "selector": "source.racket"
        }
    }
}

Ruby / Ruby on Rails

There are multiple options:

Solargraph

  1. Install solargraph.

  2. Open Preferences > Package Settings > LSP > Settings and add the "ruby" client configuration to the "clients":

    {
        "clients": {
            "ruby": {
                "enabled": true,
                "command": ["solargraph", "stdio"],
                "selector": "source.ruby | text.html.ruby",
                "initializationOptions": {
                    "diagnostics": true
                }
            }
        }
    }

Sorbet

  1. Install the sorbet and sorbet-runtime gem (see github:sorbet/sorbet):

    gem install sorbet
    gem install sorbet-runtime

    If you have a Gemfile, using bundler, add sorbet and sorbet-runtime to your Gemfile and run:

    bundle install
  2. Open Preferences > Package Settings > LSP > Settings and add the "sorbet" client configuration to the "clients":

    {
        "clients": {
            "sorbet": {
                "enabled": true,
                "command": ["srb", "tc", "--typed", "true", "--enable-all-experimental-lsp-features", "--lsp", "--disable-watchman"],
                "selector": "source.ruby | text.html.ruby",
            }
        }
    }

Stimulus LSP

  1. Install the stimulus-language-server package (see github:marcoroth/stimulus-lsp):

    npm install -g stimulus-language-server
  2. Open Preferences > Package Settings > LSP > Settings and add the "stimulus" client configuration to the "clients":

    {
        "clients": {
            "stimulus": {
                "enabled": true,
                "command": ["stimulus-language-server", "--stdio"],
                "selector": "text.html.rails"
            }
        }
    }

Ruby LSP

  1. Install the ruby-lsp gem (see github:Shopify/ruby-lsp):

    gem install ruby-lsp
  2. Open Preferences > Package Settings > LSP > Settings and add the "ruby-lsp" client configuration to the "clients":

    {
        "clients": {
            "ruby-lsp": {
                "enabled": true,
                "command": ["ruby-lsp"],
                "selector": "source.ruby | text.html.ruby",
                "initializationOptions": {
                    "enabledFeatures": {
                        "diagnostics": true
                    },
                    "experimentalFeaturesEnabled": true
                }
            }
        }
    }

Steep

  1. Install the steep gem (see github:soutaro/steep):

    gem install steep
  2. Open Preferences > Package Settings > LSP > Settings and add the "steep" client configuration to the "clients":

    {
        "clients": {
            "steep": {
                "enabled": true,
                "command": ["steep", "langserver"],
                "selector": "source.ruby | text.html.ruby",
            }
        }
    }

Rust

Follow installation instructions on LSP-rust-analyzer.

Sass

Follow installation instructions on LSP-some-sass.

Scala

Follow installation instructions on LSP-metals.

Shell

  1. Install shellcheck (follow instructions in the repo).

  2. Install the diagnostic-languageserver server.

    # with NPM
    npm i -g diagnostic-languageserver
    # or with Yarn
    yarn global add diagnostic-languageserver
  3. Open Preferences > Package Settings > LSP > Settings and add the "diagnostic-ls" client configuration to the "clients":

    {
        "clients": {
            "diagnostic-ls": {
                "enabled": true,
                "command": ["diagnostic-languageserver", "--stdio"],
                "selector": "source.shell.bash",
                "initializationOptions": {
                    "linters": {
                        "shellcheck": {
                            "command": "shellcheck",
                            "args": ["--format=json", "-"],
                            "debounce": 100,
                            "formatLines": 1,
                            "offsetLine": 0,
                            "offsetColumn": 0,
                            "sourceName": "shellcheck",
                            "parseJson": {
                                "line": "line",
                                "column": "column",
                                "endLine": "endLine",
                                "endColumn": "endColumn",
                                "security": "level",
                                "message": "\\${message} [\\${code}]",
                            },
                            "securities": {
                                "error": "error",
                                "warning": "warning",
                                "note": "info",
                            },
                        }
                    },
                    "formatters": {},
                    "filetypes": {
                        "shellscript": "shellcheck",
                    }
                }
            }
        }
    }

Solidity

  1. Install the Ethereum package from Package Control for syntax highlighting.

  2. Install the github:NomicFoundation/hardhat-vscode language server.

  3. Open Preferences > Package Settings > LSP > Settings and add the "solidity" client configuration to the "clients":

    {
        "clients": {
            "solidity": {
                "enabled": true,
                "command": ["nomicfoundation-solidity-language-server", "--stdio"],
                "selector": "source.solidity"
            }
        }
    }

Stylelint

Follow installation instructions on LSP-stylelint.

Svelte

Follow installation instructions on LSP-svelte.

Swift

Follow installation instructions on LSP-SourceKit.

SystemVerilog

  1. Install the SystemVerilog package from Package Control for syntax highlighting.

  2. Make sure you install the latest version of Verible.

  3. Open Preferences > Package Settings > LSP > Settings and add the "verible" client configuration to the "clients":

    {
        "clients": {
            "verible": {
                "enabled": true,
                "command": [
                    "/PATH/TO/verible-verilog-ls"
                ],
                "selector": "source.systemverilog"
            }
        }
    }

TAGML

Follow installation instructions on LSP-tagml.

Tailwind CSS

Follow installation instructions on LSP-tailwindcss.

Terraform

Follow installation instructions on LSP-terraform.

Toit

  1. Install the Toit package from Package Control for syntax highlighting.

  2. Install the Jaguar Language Server.

  3. Open Preferences > Package Settings > LSP > Settings and add the "jag" client configuration to the "clients":

    {
        "clients": {
            "jag": {
                "enabled": true,
                "command": ["jag" "lsp"],
                "selector": "source.toit"
            }
        }
    }

Twig

Follow installation instructions on LSP-twiggy.

TypeScript

See Javascript/TypeScript.

Typst

  1. Install the Typst package from Package Control for syntax highlighting.

  2. Optional: to enable auto-completions for the relevant situations in Typst files, adjust Sublime's "auto_complete_selector" and/or "auto_complete_triggers" setting (Preferences > Settings); for example

    {
        "auto_complete_triggers":
        [
            {"selector": "text.html, text.xml", "characters": "<"},
            {"selector": "punctuation.accessor", "rhs_empty": true},
            {"selector": "text.typst", "characters": "#", "rhs_empty": true},
        ],
    }

There are 2 available languages servers.

Tinymist

This server has more features, like go to definition, rename, etc.

  1. Install tinymist.

  2. Open Preferences > Package Settings > LSP > Settings and add the "tinymist" client configuration to the "clients":

    {
        "clients": {
            "tinymist": {
                "enabled": true,
                "command": ["path/to/tinymist"],  // adjust this path according to your platform/setup
                "selector": "text.typst",
                // you can provide some initialization options:
                "initializationOptions": {
                    "exportPdf": "never",
                    "typstExtraArgs": [],
                },
            }
        }
    }
  3. Optional: to enable some useful commands provided by language server, add the following to the *.sublime-commands:

    [
        // ...
        {
            "caption": "tinymist - Pin the main file to the currently opened document",
            "command": "lsp_execute",
            "args": {
                "session_name": "tinymist",
                "command_name": "tinymist.pinMain",
                "command_args": ["${file}"]
            }
        },
        {
            "caption": "tinymist - Unpin the main file",
            "command": "lsp_execute",
            "args": {
                "session_name": "tinymist",
                "command_name": "tinymist.pinMain",
                "command_args": [null]
            }
        },
    ]

Typst-lsp

  1. Install typst-lsp.

  2. Open Preferences > Package Settings > LSP > Settings and add the "typst-lsp" client configuration to the "clients":

    {
        "clients": {
            "typst-lsp": {
                "enabled": true,
                "command": ["path/to/typst-lsp"],  // adjust this path according to your platform/setup
                "selector": "text.typst"
            }
        }
    }
  3. Optional: to enable some useful commands provided by language server, add the following to the *.sublime-commands:

    [
        // ...
        {
            "caption": "typst-lsp - Pin the main file to the currently opened document",
            "command": "lsp_execute",
            "args": {
                "session_name": "typst-lsp",
                "command_name": "typst-lsp.doPinMain",
                "command_args": ["${file_uri}"]
            }
        },
        {
            "caption": "typst-lsp - Unpin the main file",
            "command": "lsp_execute",
            "args": {
                "session_name": "typst-lsp",
                "command_name": "typst-lsp.doPinMain",
                "command_args": ["detached"]
            }
        },
    ]

Vue

There are multiple options:

Vue Language Server

Recommended, actively maintained package based on vuejs/language-tools.

Follow installation instructions on LSP-vue.

Volar

Based on 1.x version of Volar (later renamed to Vue Language Server). Not recommended.

Follow installation instructions on LSP-volar.

Vetur

No longer maintained, not compatible with TypeScript 5+ or new Vue versions.

Follow installation instructions on LSP-vetur.

Vala

  1. Install the Vala-TMBundle package from Package Control to add Vala syntax highlighting and for Vala files to be reconginsed.

  2. Install the Vala Language Server

  3. Add Vala Langauge Server to LSP settings:

    {
        "clients": {
            "vala-language-server": {
                "enabled": true,
                "command": [
                    "/path/to/vala-language-server"
                ],
                "selector": "source.vala | source.genie"
            },
        },
    }

!!! warning "Only works for certain project types. Visit vala-language-server repo for more details."

XML

Follow installation instructions on LSP-lemminx.

YAML

Follow installation instructions on LSP-yaml.