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

Ruff Formatting Overrides Black #2440

Open
1 task done
sebastian9 opened this issue Oct 21, 2024 · 1 comment
Open
1 task done

Ruff Formatting Overrides Black #2440

sebastian9 opened this issue Oct 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sebastian9
Copy link

Field Description
Plugin lsp.servers.pylsp.ruff
Nixpkgs 24.05
Home Manager 24.05
  • I have read the FAQ and my bug is not listed there.

Description

Whenever I install ruff, either inside or outside the pylsp module, it will insist in formatting my files and overriding black.

  • I should be able to use black as a formatter, it differs slightly from ruff and my team's CI is using black.
  • I should be able to do this while leaving lsp-format enabled, as that option affects formatting configuration for other languages. If I remove this, the code is correctly formatted with black.

Minimal, Reproducible Example (MRE)

Conform info

Formatters for this buffer:
LSP: pylsp
black ready (python) /Users/<user>/.local/bin/black
_: {
  programs = {
    nixvim = {
      plugins = {
        lsp.enable = true;
        lsp-format.enable = true;
        conform-nvim.formattersByFt = {
        enable = true;
        formatOnSave = {
          lspFallback = true;
          timeoutMs = 500;
        };
        notifyOnError = true;
          python = [
            "black"
          ];
        };
        lint.lintersByFt.python = [
          "ruff"
        ];
        lsp.servers = {
          pylsp = {
            enable = true;
            settings.plugins = {
              black.enabled = true;
              ruff.enabled = true;
            };
          };
        };
      };
    };
  };
}
@sebastian9 sebastian9 added the bug Something isn't working label Oct 21, 2024
@MattSturgeon
Copy link
Member

Could you use an ftplugin to disable lsp formatting only for python files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants