English | 简体中文
lsp-bridge's goal is to become the fastest LSP client in the Emacs.
lsp-bridge use python threading technology build cache bridge between Emacs and LSP server, you will never feel stuck when you write the code.
- Install Python dependences: python-epc
- Install Elisp dependences: corfu ,all-the-icons, Orderless, posframe, markdown-mode, yasnippet
- Clone or download this repository (path of the folder is the
<path-to-lsp-bridge>
used below). - Add follow code in your ~/.emacs:
(add-to-list 'load-path "<path-to-lsp-bridge>")
(require 'yasnippet)
(require 'lsp-bridge) ;; load lsp-bridge
(require 'lsp-bridge-orderless) ;; make lsp-bridge support fuzzy match, optional
(require 'lsp-bridge-icon) ;; show icon for completion items, optional
(global-corfu-mode) ;; use corfu as completion ui
(global-lsp-bridge-mode)
(yas-global-mode 1)
- lsp-bridge-find-def: jump to the definition position
- lsp-bridge-find-def-other-window: jump to the definition position in other-window
- lsp-bridge-find-impl: jump to the implementation position
- lsp-bridge-find-impl-other-window: jump to the implementation position in other-window
- lsp-bridge-return-from-def: return to location before lsp-bridge-find-def
- lsp-bridge-find-references: traversing across code references (fork from color-rg.el)
- lsp-bridge-lookup-documentation: lookup documentation of cursor
- lsp-bridge-rename: rename the cursor content
- lsp-bridge-show-signature-help-in-minibuffer: show signature help in minibuffer manually (move cursor to parameters area will show signature help automatically)
- lsp-bridge-restart-process: restart lsp-bridge process (only used for development)
lsp-bridge default configuration for lang server store at lsp-bridge/langserver.
Anyway you can customize server configuration with below priority:
lsp-bridge-get-lang-server-by-project
: write your own function to get server configuration base on project-path and file-path, default this function is nillsp-bridge-lang-server-extension-list
: get server configuration base on file extension, such as, we launchvolar
server insteadjavascript
server when open *.vue filelsp-bridge-lang-server-mode-list
: get server configuration base on major-mode
- Create settings file under lsp-bridge/langserver, such as
pyright.json
is use for pyright (windows usepyright_windows.json
, macOS usepyright_darwin.json
). - Add
(mode . server_name)
inlsp-bridge-lang-server-list
, such as(python-mode . "pyright")
- Add new mode-hook to
lsp-bridge-default-mode-hooks
Welcome send PR to help us improve support for LSP servers, thank you!
- clangd (c, c++)
- pyright (python)
- solargraph (ruby)
- rust-analyzer (rust)
- elixirLS (elixir) Note: please ensure export
elixir-ls
release directory in your system PATH at first. - gopls (go)
- hls (haskell)
- dart-analysis-server (dart)
- metals (scala)
- typescript (typescript, javascript)
- ocamllsp (ocaml)
- erlang-ls (erlang)
- texlab (latex)
- eclipse.jdt.ls (java) Note: please ensure export
org.eclipse.jdt.ls.product/target/repository/bin
in your system PATH at first. - clojure-lsp (clojure)
- bash-language-server (bash)
- volar (vue)
- sumneko (lua) Note: please ensure export
bin
under sumneko installation in your system PATH at first. - wxml-language-server (wxml)
- vscode-html-language-server (html)
- vscode-css-language-server (css)
- elm-language-server (elm)
- Show signature help with eldoc
- Code action
- Inline Value
- One file open multi-server, and mixed multi-result to corfu menu
lsp-bridge goal is become the fastest LSP client in the Emacs, not the complete implementation of LSP protocol.
The following function Emacs can do better, we will not repeat in lsp-bridge:
- Code format: each LSP server has its own formatting specification, with the formatting function of Emacs, we will get more detail control
- Diagnostics: Flycheck or Flymake is better chooise
- Syntax highlight: Tree-sitter is a wonderful incremental parsing library to implement highlight code
Below is framework of lsp-bridge:
Please read LSP Specification and The Design of lsp-bridge first.
Then turn on option lsp-bridge-enable-log
and happy hacking! ;)
Please use emacs -q
and load a minimal setup with only lsp-bridge to verify that the bug is reproducible. If emacs -q
works fine, probably something is wrong with your Emacs config.
If the problem persists, please report it here with *lsp-bridge*
buffer content, it contains many clues that can help us locate the problem faster.
If you get a segfault error, please use the following way to collect crash information:
- Install gdb and turn on option
lsp-bridge-enable-debug
- Use the command
lsp-bridge-stop-process
to stop the current process - Restart lsp-bridge, send issue with
*lsp-bridge*
buffer content when next crash