ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Support and Integration for VSCode

Open harshalchaudhari35 opened this issue 1 year ago • 4 comments

Is there a way to add ruff as a python linter in VScode?

harshalchaudhari35 avatar Sep 07 '22 09:09 harshalchaudhari35

If the maintainers decide that editor integration is in scope for this project rather than separate dedicated projects, I would like to suggest using Language Server Protocol for this to allow usage with many editors at once (editors that support it include: Visual Studio, Visual Studio Code, Neovim, Sublime Text, JetBrains Fleet, and more): https://microsoft.github.io/language-server-protocol/

Jackenmen avatar Sep 13 '22 23:09 Jackenmen

I think @jack1142 made a good suggestion here. I just researched a little, and integrating ruff as a linter in VSCode is not trivial. The best way is to create a PR for the official Python extension. It doesn't look too complicated, but I am also not sure if they are willing to support a new, not fully stable linter.

As a Neovim user, I am happier with a LSP, which is easily integrable. I might take a look at it.

HallerPatrick avatar Sep 15 '22 18:09 HallerPatrick

VS Code Python team is actually pushing for this as well (LSP-based integrations, not necessarily the linter themselves implementing language server protocol themselves), they're working on extension templates and stuff like that to make it easy to create new integrations for linters with hopefully no TypeScript knowledge required (unlike the current solution which does require that). Considering that a lot of this is still being worked on, it might not make sense to work on VS Code specific extension just yet. LSP is generic enough that it's likely that not much will be needed to make a VS Code specific extension for it in the future.

Here are a bunch of related issues:

  • https://github.com/psf/black/issues/2883
  • https://github.com/PyCQA/isort/issues/1904
  • https://github.com/PyCQA/pylint/issues/5796
  • https://github.com/PyCQA/flake8/issues/1467

Jackenmen avatar Sep 15 '22 19:09 Jackenmen