From 6447c32ac63766788d77178d49474ef06971878d Mon Sep 17 00:00:00 2001 From: ccQpein Date: Sat, 14 Sep 2024 02:51:56 -0400 Subject: [PATCH] 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 --- CHANGELOG.org | 1 + clients/{lsp-ruff-lsp.el => lsp-ruff.el} | 81 ++++++++++++------------ docs/lsp-clients.json | 8 +-- lsp-mode.el | 2 +- mkdocs.yml | 2 +- 5 files changed, 48 insertions(+), 46 deletions(-) rename clients/{lsp-ruff-lsp.el => lsp-ruff.el} (52%) diff --git a/CHANGELOG.org b/CHANGELOG.org index c0d7336f0c5..202cfb4f60f 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -10,6 +10,7 @@ * Add basic support for [[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics][pull diagnostics]] requests. * Add ~lsp-flush-delayed-changes-before-next-message~ customization point to enforce throttling document change notifications. * 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. + * 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"]~. ** 9.0.0 * Add language server config for QML (Qt Modeling Language) using qmlls. diff --git a/clients/lsp-ruff-lsp.el b/clients/lsp-ruff.el similarity index 52% rename from clients/lsp-ruff-lsp.el rename to clients/lsp-ruff.el index c95359d5c18..96ddddba213 100644 --- a/clients/lsp-ruff-lsp.el +++ b/clients/lsp-ruff.el @@ -1,4 +1,4 @@ -;;; lsp-ruff-lsp.el --- ruff-lsp support -*- lexical-binding: t; -*- +;;; lsp-ruff.el --- ruff lsp support -*- lexical-binding: t; -*- ;; Copyright (C) 2023 Freja Nordsiek ;; @@ -20,96 +20,97 @@ ;;; Commentary: -;; ruff-lsp Client for the Python programming language +;; ruff LSP Client for the Python programming language ;;; Code: (require 'lsp-mode) -(defgroup lsp-ruff-lsp nil - "LSP support for Python, using ruff-lsp's Python Language Server." +(defgroup lsp-ruff nil + "LSP support for Python, using ruff's Python Language Server." :group 'lsp-mode - :link '(url-link "https://github.com/charliermarsh/ruff-lsp")) + :link '(url-link "https://github.com/astral-sh/ruff")) -(defcustom lsp-ruff-lsp-server-command '("ruff-lsp") - "Command to start ruff-lsp." +(defcustom lsp-ruff-server-command '("ruff" "server") + "Command to start ruff lsp. +Previous ruff-lsp should change this to (\"ruff-lsp\")" :risky t :type '(repeat string) - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-ruff-path ["ruff"] +(defcustom lsp-ruff-ruff-path ["ruff"] "Paths to ruff to try, in order." :risky t :type 'lsp-string-vector - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-ruff-args [] +(defcustom lsp-ruff-ruff-args [] "Arguments, passed to ruff." :risky t :type 'lsp-string-vector - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-log-level "error" +(defcustom lsp-ruff-log-level "error" "Tracing level." :type '(choice (const "debug") (const "error") (const "info") (const "off") (const "warn")) - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-python-path "python3" +(defcustom lsp-ruff-python-path "python3" "Path to the Python interpreter." :risky t :type 'string - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-show-notifications "off" +(defcustom lsp-ruff-show-notifications "off" "When notifications are shown." :type '(choice (const "off") (const "onError") (const "onWarning") (const "always")) - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-advertize-organize-imports t +(defcustom lsp-ruff-advertize-organize-imports t "Whether to report ability to handle source.organizeImports actions." :type 'boolean - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-advertize-fix-all t +(defcustom lsp-ruff-advertize-fix-all t "Whether to report ability to handle source.fixAll actions." :type 'boolean - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) -(defcustom lsp-ruff-lsp-import-strategy "fromEnvironment" - "Where ruff is imported from if lsp-ruff-lsp-ruff-path is not set." +(defcustom lsp-ruff-import-strategy "fromEnvironment" + "Where ruff is imported from if lsp-ruff-ruff-path is not set." :type '(choice (const "fromEnvironment") (const "useBundled")) - :group 'lsp-ruff-lsp) + :group 'lsp-ruff) (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection - (lambda () lsp-ruff-lsp-server-command)) + (lambda () lsp-ruff-server-command)) :activation-fn (lsp-activate-on "python") - :server-id 'ruff-lsp + :server-id 'ruff :priority -2 :add-on? t :initialization-options (lambda () (list :settings - (list :args lsp-ruff-lsp-ruff-args - :logLevel lsp-ruff-lsp-log-level - :path lsp-ruff-lsp-ruff-path - :interpreter (vector lsp-ruff-lsp-python-path) - :showNotifications lsp-ruff-lsp-show-notifications - :organizeImports (lsp-json-bool lsp-ruff-lsp-advertize-organize-imports) - :fixAll (lsp-json-bool lsp-ruff-lsp-advertize-fix-all) - :importStrategy lsp-ruff-lsp-import-strategy))))) - -(lsp-consistency-check lsp-ruff-lsp) - -(provide 'lsp-ruff-lsp) -;;; lsp-ruff-lsp.el ends here + (list :args lsp-ruff-ruff-args + :logLevel lsp-ruff-log-level + :path lsp-ruff-ruff-path + :interpreter (vector lsp-ruff-python-path) + :showNotifications lsp-ruff-show-notifications + :organizeImports (lsp-json-bool lsp-ruff-advertize-organize-imports) + :fixAll (lsp-json-bool lsp-ruff-advertize-fix-all) + :importStrategy lsp-ruff-import-strategy))))) + +(lsp-consistency-check lsp-ruff) + +(provide 'lsp-ruff) +;;; lsp-ruff.el ends here diff --git a/docs/lsp-clients.json b/docs/lsp-clients.json index b3d88fef399..c619ec15d92 100644 --- a/docs/lsp-clients.json +++ b/docs/lsp-clients.json @@ -941,11 +941,11 @@ "debugger": "Not available" }, { - "name": "ruff-lsp", + "name": "ruff", "full-name": "Python", - "server-name": "ruff-lsp", - "server-url": "https://github.com/charliermarsh/ruff-lsp", - "installation": "pip install ruff-lsp", + "server-name": "ruff", + "server-url": "https://github.com/astral-sh/ruff", + "installation": "pip install ruff (previous pip install ruff-lsp)", "debugger": "Not available" }, { diff --git a/lsp-mode.el b/lsp-mode.el index 0ed4c219f4f..7c9c824eb4a 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -186,7 +186,7 @@ As defined by the Language Server Protocol 3.16." lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator lsp-php lsp-pls lsp-purescript lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms lsp-qml lsp-r lsp-racket lsp-remark lsp-rf lsp-roslyn lsp-rubocop lsp-ruby-lsp - lsp-ruby-syntax-tree lsp-ruff-lsp lsp-rust lsp-semgrep lsp-shader + lsp-ruby-syntax-tree lsp-ruff lsp-rust lsp-semgrep lsp-shader lsp-solargraph lsp-solidity lsp-sonarlint lsp-sorbet lsp-sourcekit lsp-sql lsp-sqls lsp-steep lsp-svelte lsp-tailwindcss lsp-terraform lsp-tex lsp-tilt lsp-toml lsp-trunk lsp-ttcn3 lsp-typeprof lsp-v diff --git a/mkdocs.yml b/mkdocs.yml index 6d6ba6ce60a..98241d90bfc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -138,7 +138,7 @@ nav: - Python (Palantir deprecated): page/lsp-pyls.md - Python (Pyright): https://emacs-lsp.github.io/lsp-pyright - Python (Microsoft): https://emacs-lsp.github.io/lsp-python-ms - - Python (Ruff): page/lsp-ruff-lsp.md + - Python (Ruff): page/lsp-ruff.md - QML: page/lsp-qml.md - R: page/lsp-r.md - Racket (jeapostrophe): page/lsp-racket-langserver.md