64

LSP for Sublime Text

 3 years ago
source link: https://lsp.sublimetext.io/language_servers/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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.

We recommend installing LSP-json.

LSP-json provides completions and diagnostics when editing JSON files that adhere to a JSON schema.

For legacy ST3 docs, see lsp.readthedocs.io.

Angular#

Follow installation instructions on LSP-angular.

Bash#

Follow installation instructions on LSP-bash.

Also see Shell.

C/C++#

See the dedicated C/C++ guide for using ccls or 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": ["java", "-jar", "/PATH/TO/clojure-lsp"], // Update the PATH
                "selector": "source.clojure",
                "initializationOptions": {}
            }
        }
    }
    

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 "dls" client configuration to the "clients":

    {
        "clients": {
            "dls": {
                "enabled": true,
                "command": ["/PATH/TO/DLS_EXECUTABLE"], // Update the PATH
                "selector": "source.d"
            }
        }
    }
    

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"
            }
        }
    }
    

ESLint#

Follow installation instructions on LSP-eslint.

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": ["dotnet", "fsautocomplete", "--background-service-enabled"],
                "selector": "source.fsharp",
                "initializationOptions": {
                    "AutomaticWorkspaceInit": true
                }
            }
        }
    }
    

Flow#

Follow installation instructions on LSP-flow.

Fortran#

  1. Install the Fortran package from Package Control for syntax highlighting.
  2. Install the Fortran Language Server.
  3. Open Preferences > Package Settings > LSP > Settings and add the "fortls" client configuration to the "clients":

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

See available configuration options.

For example set "command": ["fortls", "--lowercase_intrinsics"] to use lowercase for autocomplete suggestions.

Go#

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

    {
        "clients": {
            "gopls": {
                "enabled": true,
                "command": ["gopls"],
                "selector": "source.go",
                "initializationOptions": {
                    "experimentalWorkspaceModule": false
                }
            }
        }
    }
    

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.

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.

JSON#

Follow installation instructions on LSP-json.

Julia#

  1. Install the Julia package from Package Control for syntax highlighting.
  2. Install the LanguageServer and SymbolServer packages from the Julia REPL:

    import Pkg;
    Pkg.add("LanguageServer")
    Pkg.add("SymbolServer")
    
  3. Open Preferences > Package Settings > LSP > Settings and add the "julials" client configuration to the "clients":

    {
        "clients": {
            "julials": {
                "enabled": true,
                "command": ["bash", "PATH_TO_JULIA_SERVER/LanguageServer/contrib/languageserver.sh"], // on Linux/macOS
              // "command": ["julia", "--startup-file=no", "--history-file=no", "-e", "using Pkg; using LanguageServer; using LanguageServer.SymbolServer; env_path=dirname(Pkg.Types.Context().env.project_file); server=LanguageServer.LanguageServerInstance(stdin,stdout,false,env_path); run(server)"], // on Windows
                "selector": "source.julia",
                "settings": {
                    // Default values from VS Code:
                    "julia.format.calls": true,      // Format function calls
                    "julia.format.comments": true,   // Format comments
                    "julia.format.curly": true,      // Format braces
                    "julia.format.docs": true,       // Format inline documentation
                    "julia.format.indent": 4,        // Indent size for formatting
                    "julia.format.indents": true,    // Format file indents
                    "julia.format.iterOps": true,    // Format loop iterators
                    "julia.format.kw": true,         // Remove spaces around = in function keywords
                    "julia.format.lineends": false,  // [undocumented]
                    "julia.format.ops": true,        // Format whitespace around operators
                    "julia.format.tuples": true,     // Format tuples
                    "julia.lint.call": false,        // Check calls against existing methods (experimental)
                    "julia.lint.constif": true,      // Check for constant conditionals of if statements
                    "julia.lint.datadecl": false,    // [undocumented]
                    "julia.lint.iter": true,         // Check iterator syntax of loops
                    "julia.lint.lazy": true,         // Check for deterministic lazy boolean operators
                    "julia.lint.modname": true,      // Check for invalid submodule names
                    "julia.lint.nothingcomp": false, // [undocumented]
                    "julia.lint.pirates": true,      // Check for type piracy
                    "julia.lint.run": true,          // run the linter on active files
                    "julia.lint.typeparam": true     // Check for unused DataType parameters
                }
            }
        }
    }
    

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#

Follow installation instructions on LSP-TexLab.

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"
            }
        }
    }
    

Lua#

Follow installation instructions on LSP-lua.

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"
            }
        }
    }
    

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": "source.php"
            }
        }
    }
    

PowerShell#

Follow installation instructions on LSP-PowerShellEditorServices.

Python#

There are multiple options:

Pyright#

Follow installation instructions on LSP-pyright.

Python LSP Server#

Follow installation instructions on LSP-pylsp.

R#

Follow installation instructions on R-IDE.

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": false
                }
            }
        }
    }
    

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",
            }
        }
    }
    

Rust#

There are multiple options:

Rust Analyzer#

  1. Download a binary from the release page of rust-analyzer.
  2. Rename the binary to rust-analyzer.
  3. Make sure the binary is in your $PATH.
  4. Open Preferences > Package Settings > LSP > Settings and add the "rust-analyzer" client configuration to the "clients":

    {
        "clients": {
            "rust-analyzer": {
                "enabled": true,
                "command": ["rust-analyzer"],
                "selector": "source.rust"
            }
        }
    }
    

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",
                    }
                }
            }
        }
    }
    

Stylelint#

Follow installation instructions on LSP-stylelint.

Svelte#

Follow installation instructions on LSP-svelte.

Swift#

Follow installation instructions on LSP-SourceKit.

TAGML#

Follow installation instructions on LSP-tagml.

Tailwind CSS#

Follow installation instructions on LSP-tailwindcss.

Terraform#

  1. Install the Terraform package from Package Control for syntax highlighting.
  2. Download terraform-lsp binary and make it available in your PATH.
  3. Open Preferences > Package Settings > LSP > Settings and add the "terraform" client configuration to the "clients":

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

TypeScript / JavaScript#

Follow installation instructions on LSP-typescript.

For development using the Deno framework follow installation instructions on LSP-Deno.

Vue#

Follow installation instructions on LSP-vue.

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": {
                "command": [
                    "/path/to/vala-language-server"
                ],
                "selector": "source.vala | source.genie"
            },
        },
    }
    
  4. Enable the Vala Langauge Server for the project by going to Tools > LSP > Enable Language Server In Project...

  5. For the server to fully understand your code, you will need to generate a compile_commands.json file or build your project with meson.

XML#

Follow installation instructions on LSP-lemminx.

YAML#

Follow installation instructions on LSP-yaml.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK