Skip to content

Commit 6447c32

Browse files
authored
Update ruff-lsp to ruff of Python (#4543)
* update ruff-lsp to ruff * rename lsp-ruff-lsp to ruff-lsp * change custom var and some crumbs of ruff-lsp to ruff * change log * tiny change
1 parent 213f207 commit 6447c32

File tree

5 files changed

+48
-46
lines changed

5 files changed

+48
-46
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Add basic support for [[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics][pull diagnostics]] requests.
1111
* Add ~lsp-flush-delayed-changes-before-next-message~ customization point to enforce throttling document change notifications.
1212
* Fix bug in ~rust-analyzer.check.features~ configuration via ~lsp-rust-checkonsave-features~ Emacs setting: we were defaulting to ~[]~, but ~rust-analyzer~ defaults to inheriting the value from ~rust-analyzer.cargo.features~. The bug resulted in code hidden behind features not getting type checked when those features were enabled by setting ~rust-analyzer.cargo.features~ via the ~lsp-rust-features~ Emacs setting.
13+
* Change ~ruff-lsp~ to ~ruff~ for python lsp client. All ~ruff-lsp~ customizable variable change to ~ruff~. Lsp server command now is ~["ruff" "server"]~ instead of ~["ruff-lsp"]~.
1314

1415
** 9.0.0
1516
* Add language server config for QML (Qt Modeling Language) using qmlls.
Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; lsp-ruff-lsp.el --- ruff-lsp support -*- lexical-binding: t; -*-
1+
;;; lsp-ruff.el --- ruff lsp support -*- lexical-binding: t; -*-
22

33
;; Copyright (C) 2023 Freja Nordsiek
44
;;
@@ -20,96 +20,97 @@
2020

2121
;;; Commentary:
2222

23-
;; ruff-lsp Client for the Python programming language
23+
;; ruff LSP Client for the Python programming language
2424

2525
;;; Code:
2626

2727
(require 'lsp-mode)
2828

29-
(defgroup lsp-ruff-lsp nil
30-
"LSP support for Python, using ruff-lsp's Python Language Server."
29+
(defgroup lsp-ruff nil
30+
"LSP support for Python, using ruff's Python Language Server."
3131
:group 'lsp-mode
32-
:link '(url-link "https://github.com/charliermarsh/ruff-lsp"))
32+
:link '(url-link "https://github.com/astral-sh/ruff"))
3333

34-
(defcustom lsp-ruff-lsp-server-command '("ruff-lsp")
35-
"Command to start ruff-lsp."
34+
(defcustom lsp-ruff-server-command '("ruff" "server")
35+
"Command to start ruff lsp.
36+
Previous ruff-lsp should change this to (\"ruff-lsp\")"
3637
:risky t
3738
:type '(repeat string)
38-
:group 'lsp-ruff-lsp)
39+
:group 'lsp-ruff)
3940

40-
(defcustom lsp-ruff-lsp-ruff-path ["ruff"]
41+
(defcustom lsp-ruff-ruff-path ["ruff"]
4142
"Paths to ruff to try, in order."
4243
:risky t
4344
:type 'lsp-string-vector
44-
:group 'lsp-ruff-lsp)
45+
:group 'lsp-ruff)
4546

46-
(defcustom lsp-ruff-lsp-ruff-args []
47+
(defcustom lsp-ruff-ruff-args []
4748
"Arguments, passed to ruff."
4849
:risky t
4950
:type 'lsp-string-vector
50-
:group 'lsp-ruff-lsp)
51+
:group 'lsp-ruff)
5152

52-
(defcustom lsp-ruff-lsp-log-level "error"
53+
(defcustom lsp-ruff-log-level "error"
5354
"Tracing level."
5455
:type '(choice (const "debug")
5556
(const "error")
5657
(const "info")
5758
(const "off")
5859
(const "warn"))
59-
:group 'lsp-ruff-lsp)
60+
:group 'lsp-ruff)
6061

61-
(defcustom lsp-ruff-lsp-python-path "python3"
62+
(defcustom lsp-ruff-python-path "python3"
6263
"Path to the Python interpreter."
6364
:risky t
6465
:type 'string
65-
:group 'lsp-ruff-lsp)
66+
:group 'lsp-ruff)
6667

67-
(defcustom lsp-ruff-lsp-show-notifications "off"
68+
(defcustom lsp-ruff-show-notifications "off"
6869
"When notifications are shown."
6970
:type '(choice (const "off")
7071
(const "onError")
7172
(const "onWarning")
7273
(const "always"))
73-
:group 'lsp-ruff-lsp)
74+
:group 'lsp-ruff)
7475

75-
(defcustom lsp-ruff-lsp-advertize-organize-imports t
76+
(defcustom lsp-ruff-advertize-organize-imports t
7677
"Whether to report ability to handle source.organizeImports actions."
7778
:type 'boolean
78-
:group 'lsp-ruff-lsp)
79+
:group 'lsp-ruff)
7980

80-
(defcustom lsp-ruff-lsp-advertize-fix-all t
81+
(defcustom lsp-ruff-advertize-fix-all t
8182
"Whether to report ability to handle source.fixAll actions."
8283
:type 'boolean
83-
:group 'lsp-ruff-lsp)
84+
:group 'lsp-ruff)
8485

85-
(defcustom lsp-ruff-lsp-import-strategy "fromEnvironment"
86-
"Where ruff is imported from if lsp-ruff-lsp-ruff-path is not set."
86+
(defcustom lsp-ruff-import-strategy "fromEnvironment"
87+
"Where ruff is imported from if lsp-ruff-ruff-path is not set."
8788
:type '(choice (const "fromEnvironment")
8889
(const "useBundled"))
89-
:group 'lsp-ruff-lsp)
90+
:group 'lsp-ruff)
9091

9192

9293
(lsp-register-client
9394
(make-lsp-client
9495
:new-connection (lsp-stdio-connection
95-
(lambda () lsp-ruff-lsp-server-command))
96+
(lambda () lsp-ruff-server-command))
9697
:activation-fn (lsp-activate-on "python")
97-
:server-id 'ruff-lsp
98+
:server-id 'ruff
9899
:priority -2
99100
:add-on? t
100101
:initialization-options
101102
(lambda ()
102103
(list :settings
103-
(list :args lsp-ruff-lsp-ruff-args
104-
:logLevel lsp-ruff-lsp-log-level
105-
:path lsp-ruff-lsp-ruff-path
106-
:interpreter (vector lsp-ruff-lsp-python-path)
107-
:showNotifications lsp-ruff-lsp-show-notifications
108-
:organizeImports (lsp-json-bool lsp-ruff-lsp-advertize-organize-imports)
109-
:fixAll (lsp-json-bool lsp-ruff-lsp-advertize-fix-all)
110-
:importStrategy lsp-ruff-lsp-import-strategy)))))
111-
112-
(lsp-consistency-check lsp-ruff-lsp)
113-
114-
(provide 'lsp-ruff-lsp)
115-
;;; lsp-ruff-lsp.el ends here
104+
(list :args lsp-ruff-ruff-args
105+
:logLevel lsp-ruff-log-level
106+
:path lsp-ruff-ruff-path
107+
:interpreter (vector lsp-ruff-python-path)
108+
:showNotifications lsp-ruff-show-notifications
109+
:organizeImports (lsp-json-bool lsp-ruff-advertize-organize-imports)
110+
:fixAll (lsp-json-bool lsp-ruff-advertize-fix-all)
111+
:importStrategy lsp-ruff-import-strategy)))))
112+
113+
(lsp-consistency-check lsp-ruff)
114+
115+
(provide 'lsp-ruff)
116+
;;; lsp-ruff.el ends here

docs/lsp-clients.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -941,11 +941,11 @@
941941
"debugger": "Not available"
942942
},
943943
{
944-
"name": "ruff-lsp",
944+
"name": "ruff",
945945
"full-name": "Python",
946-
"server-name": "ruff-lsp",
947-
"server-url": "https://github.com/charliermarsh/ruff-lsp",
948-
"installation": "pip install ruff-lsp",
946+
"server-name": "ruff",
947+
"server-url": "https://github.com/astral-sh/ruff",
948+
"installation": "pip install ruff (previous pip install ruff-lsp)",
949949
"debugger": "Not available"
950950
},
951951
{

lsp-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ As defined by the Language Server Protocol 3.16."
186186
lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator lsp-php lsp-pls
187187
lsp-purescript lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms
188188
lsp-qml lsp-r lsp-racket lsp-remark lsp-rf lsp-roslyn lsp-rubocop lsp-ruby-lsp
189-
lsp-ruby-syntax-tree lsp-ruff-lsp lsp-rust lsp-semgrep lsp-shader
189+
lsp-ruby-syntax-tree lsp-ruff lsp-rust lsp-semgrep lsp-shader
190190
lsp-solargraph lsp-solidity lsp-sonarlint lsp-sorbet lsp-sourcekit
191191
lsp-sql lsp-sqls lsp-steep lsp-svelte lsp-tailwindcss lsp-terraform
192192
lsp-tex lsp-tilt lsp-toml lsp-trunk lsp-ttcn3 lsp-typeprof lsp-v

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ nav:
138138
- Python (Palantir deprecated): page/lsp-pyls.md
139139
- Python (Pyright): https://emacs-lsp.github.io/lsp-pyright
140140
- Python (Microsoft): https://emacs-lsp.github.io/lsp-python-ms
141-
- Python (Ruff): page/lsp-ruff-lsp.md
141+
- Python (Ruff): page/lsp-ruff.md
142142
- QML: page/lsp-qml.md
143143
- R: page/lsp-r.md
144144
- Racket (jeapostrophe): page/lsp-racket-langserver.md

0 commit comments

Comments
 (0)