lsp-mode
Table of Contents
:ID: 040AE749-B677-4481-A65B-19FB842CE227
https://emacs-lsp.github.io/lsp-mode/ https://develop.spacemacs.org/layers/+lang/ruby/README.html#language-server-protocol
# Selecting language servers
If there are multiple installed, the highest priority will win. To select the server you want independent of priority you can do this:
(add-to-list 'lsp-disabled-clients 'ruby-ls) ;; solargraph (add-to-list 'lsp-enabled-clients 'ruby-lsp-ls) ;; ruby-lsp (shopify's thing)
# Typescript / Javascript
# Setup
Followed these instructions https://emacs-lsp.github.io/lsp-mode/page/lsp-typescript/ for ls-ts Node dependencies needed:
- typescript-language-server
- typescript
Weirdly, I got an error that it couldn’t find typescript even though it was installed globably and was in my path. I had to copy the node module into the emacs npm cache:
cp -R .config/yarn/global/node_modules/typescript spacemacs/.cache/lsp/npm/typescript
# Ruby
There are a bunch of options for LSP servers. You can have multiple servers and the one used can be specified in a dir-local file See also emacs-lsp FAQ
# Ruby LSP
https://github.com/Shopify/ruby-lsp
2023-08-04: I tried it but it didn’t appear to have jump to definition or any features for that matter.
# Solargraph
It doesn’t require yard, but it can help it out.
# Setup
Just follow the instructions linked above. For spacemacs, set the ruby-mode
backend to 'lsp
- Rails
Use the solargraph-rails plugin. When using this you’ll need to include
"**/*.rb"
and use the exclude directive in the .solargraph.yml
# Features
- autocompletion
- other things…
cmd | description |
---|---|
lsp-ui-peek-jump-backward | Moves cursor back to the previous location |
lsp-ui-peek-jump-forward | Moves cursor back to the next location |
lsp-ui-peek-find-references | Shows a list of where something is used in the code |
lsp-ui-peek-find-definitions | Navigate to definition of thing at point |
lsp-describe-thing-at-point | Shows documentation |
# Vue2
Install vls
# Issues
When trying to start vls:
Error: Cannot find module 'vscode-css-languageservice/lib/umd/data/browsers'
# Performance
I had performance issues with LSP mode, especially with Typescript.
See https://emacs-lsp.github.io/lsp-mode/page/performance/ for suggestions.
I increased the read-process-output-max
to 3mb and that seemed to help.
I was already using emacs v28, so I just rebuild it with native comp. There was some pain making the transition, but it completely solved the performance issues.
See https://xenodium.com/emacs-plus-with-native-comp/ and https://github.com/d12frosted/homebrew-emacs-plus#emacs-27-and-emacs-28-options
# In editor docs
This can sometimes be annoying. Turn it off with lsp-toggle-signature-auto-activate
# Listing all available clients
(hash-table-keys lsp-clients)
zls-tramp | zls | yls-tramp | yls | yamlls-tramp | yamlls | xmlls-tramp | xmlls | wgsl-analyzer-tramp | wgsl-analyzer | vue-semantic-server-tramp | vue-semantic-server | vimls-tramp | vimls | lsp-vhdl-tramp | lsp-vhdl | vls-tramp | vls | html-ls-tramp | html-ls | lsp-verilog-verible-tramp | lsp-verilog-verible | lsp-verilog-tramp | lsp-verilog | svlangserver-tramp | svlangserver | valals-tramp | valals | v-analyzer-tramp | v-analyzer | v-ls-tramp | v-ls | typespec-lsp-tramp | typespec-lsp | typeprof-ls-tramp | typeprof-ls | ntt-tramp | ntt | ts-query-ls-tramp | ts-query-ls | trunk-lsp-tramp | trunk-lsp | tombi-tramp | tombi | taplo-tramp | taplo | tiltfile-tramp | tiltfile | texlab-tramp | texlab | digestif-tramp | digestif | tfmls-tramp | tfmls | tfls-tramp | tfls | svelte-ls-tramp | svelte-ls | steep-ls-tramp | steep-ls | sqls-tramp | sqls | sql-ls-tramp | sql-ls | sorbet-ls-tramp | sorbet-ls | solidity-tramp | solidity | ruby-ls-tramp | ruby-ls | semgrep-ls-tramp | semgrep-ls | rust-analyzer-tramp | rust-analyzer | rls-tramp | rls | ruff-tramp | ruff | ruby-syntax-tree-ls-tramp | ruby-syntax-tree-ls | ruby-lsp-ls-tramp | ruby-lsp-ls | rubocop-ls-tramp | rubocop-ls | csharp-roslyn-tramp | csharp-roslyn | roc_language_server-tramp | roc_language_server | rf-intellisense-tramp | rf-intellisense | remark-tramp | remark | racket-language-server-tramp | racket-language-server | racket-langserver-tramp | racket-langserver | lsp-r-tramp | lsp-r | qml-ls-tramp | qml-ls | ty-ls-tramp | ty-ls | pylsp-tramp | pylsp | pyls-tramp | pyls | pwsh-ls-tramp | pwsh-ls | pursls-tramp | pursls | postgres-ls-tramp | postgres-ls | pls-tramp | pls | phpactor-tramp | phpactor | serenata-tramp | serenata | iph-tramp | iph | php-ls-tramp | php-ls | perlnavigator-tramp | perlnavigator | perl-language-server-tramp | perl-language-server | openscad-tramp | openscad | ols-tramp | ols | ocaml-lsp-server-tramp | ocaml-lsp-server | ocaml-ls-tramp | ocaml-ls | nushell-ls-tramp | nushell-ls | nix-nil-tramp | nix-nil | nixd-lsp-tramp | nixd-lsp | rnix-lsp-tramp | rnix-lsp | nimlangserver-tramp | nimlangserver | nimlsp-tramp | nimlsp | nginx-ls-tramp | nginx-ls | nextflow-lsp-tramp | nextflow-lsp | move-analyzer-tramp | move-analyzer | mojo-tramp | mojo | mint-ls-tramp | mint-ls | mesonlsp-tramp | mesonlsp | mdx-analyzer-tramp | mdx-analyzer | matlab-ls-tramp | matlab-ls | marksman-tramp | marksman | unified-tramp | unified | magik-tramp | magik | fennel-ls-tramp | fennel-ls | lua-roblox-language-server-tramp | lua-roblox-language-server | lsp-lua-lsp-tramp | lsp-lua-lsp | lua-language-server-tramp | lua-language-server | emmy-lua-tramp | emmy-lua | alive-lsp-tramp | alive-lsp | helm-ls-tramp | helm-ls | kotlin-ls-tramp | kotlin-ls | json-ls-tramp | json-ls | jq-lsp-tramp | jq-lsp | deno-ls-tramp | deno-ls | flow-ls-tramp | flow-ls | ts-ls-tramp | ts-ls | jsts-ls-tramp | jsts-ls | idris2-lsp-tramp | idris2-lsp | haxe-tramp | haxe | hack-tramp | hack | groovy-ls-tramp | groovy-ls | graphql-lsp-tramp | graphql-lsp | golangci-lint-tramp | golangci-lint | glslls-tramp | glslls | gleam-lsp-tramp | gleam-lsp | gdscript-tramp | gdscript | fsac-tramp | fsac | futhark-tramp | futhark | fortls-tramp | fortls | eslint-tramp | eslint | elp-tramp | elp | erlang-ls-tramp | erlang-ls | emmet-ls-tramp | emmet-ls | elm-ls-tramp | elm-ls | elixir-ls-tramp | elixir-ls | earthlyls-tramp | earthlyls | dockerfile-ls-tramp | dockerfile-ls | dhallls-tramp | dhallls | serve-d-tramp | serve-d | cypher-ls-tramp | cypher-ls | cucumber-language-server-tramp | cucumber-language-server | copilot-ls-tramp | copilot-ls | css-ls-tramp | css-ls | c3lsp-tramp | c3lsp | csharp-ls-tramp | csharp-ls | omnisharp-tramp | omnisharp | crystalline-tramp | crystalline | credo-language-server-tramp | credo-language-server | cobol-ls-tramp | cobol-ls | cmakels-tramp | cmakels | clojure-lsp-tramp | clojure-lsp | clangd-tramp | clangd | buf-tramp | buf | bufls-tramp | bufls | gopls-tramp | gopls | beancount-ls-tramp | beancount-ls | bash-ls-tramp | bash-ls | awkls-tramp | awkls | autotools-ls-tramp | autotools-ls | astro-ls-tramp | astro-ls | asm-lsp-tramp | asm-lsp | ansible-ls-tramp | ansible-ls | angular-ls-tramp | angular-ls | gpr-ls-tramp | gpr-ls | ada-ls-tramp | ada-ls | as3mxml-ls-tramp | as3mxml-ls | ccls-tramp | ccls |