From 762f47805ac2a6411e11747f86f7c19a03da326e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 18 Dec 2025 17:38:15 -0500 Subject: [PATCH] docs(python): how to change LSP server priority --- modules/lang/python/README.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/lang/python/README.org b/modules/lang/python/README.org index 4cf943222..923350c95 100644 --- a/modules/lang/python/README.org +++ b/modules/lang/python/README.org @@ -95,6 +95,24 @@ E.g. - pyright :: ~$ pip install pyright~ or ~$ npm i -g pyright~. +If you have multiple LSP servers installed and on your ~$PATH~, lsp-mode and eglot +prioritizes which will be used depending on the client's ~:priority~ (in lsp-mode) +or their order in ~eglot-server-programs~. + +To prioritize ~ty~: +#+begin_src elisp +;;; add to $DOOMDIR/config.el + +;; for eglot users +(after! python + (set-eglot-client! '(python-mode python-ts-mode) '("ty" "server"))) + +;; Not necessary for lsp-mode users, because `ty-ls' is already priority = -1 +;; (lower = higher priority). Including this for posterity: +(after! python + (set-lsp-priority! 'ty-ls -5)) ; default is -1 +#+end_src + ** Formatter Formatting is handled by the [[doom-module::editor format]] module. Python buffers use [[https://black.readthedocs.io/en/stable/getting_started.html#installation][black]], by default. [[https://github.com/astral-sh/ruff][ruff]] is also supported: