emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.72k stars 860 forks source link

Support `ruff server` #4451

Open rassie opened 1 month ago

rassie commented 1 month ago

According to https://github.com/astral-sh/ruff/pull/10158, ruff server is a re-implementation of ruff-lsp in Rust and just by that property it is very probable that ruff-lsp will be deprecated in near future. Would be nice to have a lsp-mode client for ruff server by that point.

indigoviolet commented 3 weeks ago

This is now available in beta: https://github.com/astral-sh/ruff/tree/main/crates/ruff_server#setup

Here's the blogpost about it: https://astral.sh/blog/ruff-v0.4.5

indigoviolet commented 3 weeks ago

A very basic version that seems to be working for me:

(with-eval-after-load 'lsp-mode
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-stdio-connection '("ruff" "server" "--preview"))
     :major-modes '(python-mode)
     :priority 1
     :add-on? t
     :multi-root t
     :server-id 'ruff-server)
    )
  )
(setq! lsp-disabled-clients '(python-mode . (ruff-lsp)))