Git Product home page Git Product logo

lsp-bridge's Introduction

English | 简体中文

lsp-bridge

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.

Installation

  1. Install Python dependences: python-epc
  2. Install Elisp dependences: corfu ,all-the-icons, Orderless, posframe, markdown-mode, yasnippet
  3. Clone or download this repository (path of the folder is the <path-to-lsp-bridge> used below).
  4. 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)

Commands

  • 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)

Customize language server configuration

lsp-bridge default configuration for lang server store at lsp-bridge/langserver.

Anyway you can customize server configuration with below priority:

  1. 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 nil
  2. lsp-bridge-lang-server-extension-list: get server configuration base on file extension, such as, we launch volar server instead javascript server when open *.vue file
  3. lsp-bridge-lang-server-mode-list: get server configuration base on major-mode

Add support for new language?

  1. Create settings file under lsp-bridge/langserver, such as pyright.json is use for pyright (windows use pyright_windows.json, macOS use pyright_darwin.json).
  2. Add (mode . server_name) in lsp-bridge-lang-server-list, such as (python-mode . "pyright")
  3. Add new mode-hook to lsp-bridge-default-mode-hooks

Welcome send PR to help us improve support for LSP servers, thank you!

Supported language servers

  1. clangd (c, c++)
  2. pyright (python)
  3. solargraph (ruby)
  4. rust-analyzer (rust)
  5. elixirLS (elixir) Note: please ensure export elixir-ls release directory in your system PATH at first.
  6. gopls (go)
  7. hls (haskell)
  8. dart-analysis-server (dart)
  9. metals (scala)
  10. typescript (typescript, javascript)
  11. ocamllsp (ocaml)
  12. erlang-ls (erlang)
  13. texlab (latex)
  14. eclipse.jdt.ls (java) Note: please ensure export org.eclipse.jdt.ls.product/target/repository/bin in your system PATH at first.
  15. clojure-lsp (clojure)
  16. bash-language-server (bash)
  17. volar (vue)
  18. sumneko (lua) Note: please ensure export bin under sumneko installation in your system PATH at first.
  19. wxml-language-server (wxml)
  20. vscode-html-language-server (html)
  21. vscode-css-language-server (css)
  22. elm-language-server (elm)

Features need to finish:

  • Show signature help with eldoc
  • Code action
  • Inline Value
  • One file open multi-server, and mixed multi-result to corfu menu

Features that won't support

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:

  1. Code format: each LSP server has its own formatting specification, with the formatting function of Emacs, we will get more detail control
  2. Diagnostics: Flycheck or Flymake is better chooise
  3. Syntax highlight: Tree-sitter is a wonderful incremental parsing library to implement highlight code

Join development

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! ;)

Report bug

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:

  1. Install gdb and turn on option lsp-bridge-enable-debug
  2. Use the command lsp-bridge-stop-process to stop the current process
  3. Restart lsp-bridge, send issue with *lsp-bridge* buffer content when next crash

Contributor

lsp-bridge's People

Contributors

0owen avatar 50ways2sayhard avatar aihuasxy avatar archer-n avatar bitnut avatar edmondfrank avatar georgealbert avatar jadestrong avatar jiacai2050 avatar ksqsf avatar manateelazycat avatar matthewzmd avatar thefool32 avatar vconcat avatar vitalyankh avatar vritser avatar wsw0108 avatar xinyifly avatar yqu212 avatar zbelial avatar zerolfx avatar zy9306 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.