Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions for use with Emacs #19

Open
charliermarsh opened this issue Dec 23, 2022 · 7 comments
Open

Add instructions for use with Emacs #19

charliermarsh opened this issue Dec 23, 2022 · 7 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@charliermarsh
Copy link
Member

See: astral-sh/ruff#271.

@charliermarsh charliermarsh added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Dec 23, 2022
@vikigenius
Copy link

I can open an issue in https://github.com/emacs-lsp/lsp-mode so that people interested in contributing a client for emacs will be able to do so.

@joshdpark
Copy link

I was able to get ruff-lsp to work with eglot on emacs 29 by adding the following to my init.el

(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs
               '(python-mode . ("ruff-lsp"))))

After evaluating the expression, you should be able to run M-x eglot-code-actions and select Ruff actions.

I basically just took these instructions from https://joaotavora.github.io/eglot/#Setting-Up-LSP-Servers

My system: GNU Emacs 29.0.60 (build 2, aarch64-apple-darwin22.2.0, NS appkit-2299.30 Version 13.1 (Build 22C65)) of 2023-02-09

@buhtz
Copy link

buhtz commented Mar 13, 2023

I tried it with Emacs 27 and wasn't able to get it run. Emacs itself isn't easy but using eglot, lsp-servers and all the other tools and layers involed in an IDE-like Emacs setup gives me a headake.

I will gently wait for a docu how to setup ruff-lsp/ruf for Emacs.

When creating the docu please keep in mind to make it understandable for none-hackers, too. ;)
Also what I ask myself is why I should replace my python-language-server[all] which does a lot more then just linting with a language server (ruff-lsp) that does linting only.

Does ruff-lsp do more then linting?

Or can emacs/eglot handle more then one server running?

@StrictlyMonad
Copy link

StrictlyMonad commented Jul 9, 2023

Any updates on the subject? Have been trying to integrate ruff with my eglot server, but I cannot seem to get it working.

Would appreciate it if someone who got it working with eglot can share their setup with me. For lsp-mode users, have a look at the following PR: emacs-lsp/lsp-mode#3926!

@p00f
Copy link

p00f commented Oct 24, 2023

@StrictlyMonad

(with-eval-after-load 'eglot
   (add-to-list 'eglot-server-programs
                '(python-mode . ("ruff-lsp"))))
(add-hook 'python-mode-hook #'eglot-ensure)

@chookity-pokk
Copy link

chookity-pokk commented Jan 9, 2024

My system: GNU Emacs 29.0.60 (build 2, aarch64-apple-darwin22.2.0, NS appkit-2299.30 Version 13.1 (Build 22C65)) of 2023-02-09

For me to get it working on a Mac I had to install it with brew install ruff-lsp because installing with pip wasn't working. Just an FYI for anyone using a Mac and Eglot isn't seeing ruff-lsp.

I also changed the code to be

(with-eval-after-load 'eglot
   (add-to-list 'eglot-server-programs
                '(python-ts-mode . ("ruff-lsp"))))

@whargrove
Copy link

On macOS (14.4.1) with GNU Emacs 29.3, all I have to do was:
brew install ruff-lsp
and then activate eglot mode and it just worked 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

8 participants