all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Niall Dooley <dooleyn@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 67442@debbugs.gnu.org
Subject: bug#67442: [PATCH] eglot: Add ruff-lsp as an alternative python server
Date: Mon, 27 Nov 2023 11:22:02 +0100	[thread overview]
Message-ID: <CADS3Lq6o8pKXHR48JTNvg4nrjheWxgJOz5BJgPA4r+JLj6GiJA@mail.gmail.com> (raw)
In-Reply-To: <CALDnm51Q5-HhQkTqXDX=TNLjvJZ1C0VVrSipRo-ZEPQKyfmFWQ@mail.gmail.com>

On Sun, 26 Nov 2023 at 10:53, João Távora <joaotavora@gmail.com> wrote:
> But just because we can doesn't mean we should. It's possible that the
  ruff server wasn't meant to be a full alternative to those other
  servers. Reading from its website hints ruff is mainly a linter, so it
  has a fraction of what other servers have

It is also a formatter but yes it does not provide all the features one
might expect from an LSP server.  Do the others?  I don't know if it
will provide other features in the future.  I presume if more features
are added to ruff then they would also be added to ruff-lsp.

> The proponents of this patch should argue in terms of ruff-only LSP
  support in python buffers. Maybe enough value that it's reasonable to
  install as-is, maybe not and we should wait for 'eglot-alongside'.

My argument for its inclusion is that it is a server adhering to the LSP
protocol and thus can be listed as an alternative.  Its inclusion offers
users the choice to use it or not.  It would mean users would not have
to write, install or configure built-in or third party packages to use
ruff to lint, format or organize imports in their python projects.  They
would simply need to open a python file and M-x eglot to have ruff
perform these functions.  I think users aware of it will be aware of its
capabilities and limitations.  Ruff is a young project but quickly
replacing the other linters/formatters in the python ecosystem within a
single tool.

Counter argument a ruff plugin exists for pylsp which is already listed
as an alternative and offers other LSP features not provided by
ruff-lsp.

> Or just wait for someone to code a flymake-ruff backend in
  python-mode.el. That seems much more promising way to get the intended
  ruff experience into Emacs.

That already exists [1] but I've been able to have ruff lint my code by
simply setting `python-flymake-command' as follows:

("ruff" "check" "--quiet" "--stdin-filename=stdin" "-")

This doesn't include a "ruff" prefix identifying the source of the
flymake report like we get when using it via eglot but I believe that is
because servers provides a :source parameter to distinguish multiple
sources.  Could such a prefix be added to flymake reports when not used
via eglot?  I think it would be an improvement even if they could only
be one source of the report.

Neither of these solutions allow the user to make use of the formatting
capabilities or other code actions of ruff-lsp.  Another package would
have to be used to make use of these capabilities.

> There is also the common misconception (not sure if the case here)
  that if a server isn't mentioned in 'eglot-server-programs' directly
  then Eglot doesn't support it. And this is far from the truth: if
  'ruff' is installed in a user's machine M-x eglot can easily be made
  to prompt for it. I've tried dozens of servers like that.

Not here but I can see why that might be the case - users may assume
those listed in Eglot's README are only those that are supported.  Small
correction it is 'ruff-lsp' that would need to be installed which
naturally includes 'ruff' as a dependency.

[1] https://github.com/erickgnavar/flymake-ruff





      reply	other threads:[~2023-11-27 10:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 22:42 bug#67442: [PATCH] eglot: Add ruff-lsp as an alternative python server Niall Dooley
2023-11-25  9:19 ` Eli Zaretskii
2023-11-25 11:09 ` Eli Zaretskii
2023-11-25 11:19   ` Niall Dooley
2023-11-25 12:39   ` João Távora
2023-11-25 13:00     ` Eli Zaretskii
2023-11-26  9:53       ` João Távora
2023-11-27 10:22         ` Niall Dooley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADS3Lq6o8pKXHR48JTNvg4nrjheWxgJOz5BJgPA4r+JLj6GiJA@mail.gmail.com \
    --to=dooleyn@gmail.com \
    --cc=67442@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.