0

enter image description here

No errors are being thrown for the code with a lot of issues.

enter image description here

I have tried black, ruff but nothing works. I have also tried reinstalling with mason.

I have disabled diagnostics for the lsp (pyright) because then I will get multiple similar errors for the same line. Enabling pyright diagnostics does show me errors but mypy, black, ruff aren't working.

8
  • Please do not upload images of code/data/errors.. As this question is about Python formatters, not Vim, I voted to close.
    – Friedrich
    Dec 29, 2023 at 12:38
  • @Friedrich My initial guess was something wrong with null-ls. Is this the wrong place to ask question regarding plugins of neovim?
    – Sid
    Dec 29, 2023 at 14:00
  • 1
    Some community members dislike questions about plugins. I do think they are on-topic, though. Your question, however, is not about a NeoVim plugin but about ruff and black, which are programs in their own right. You could reproduce your problem without NeoVim, running those tools from the command line. This makes your question off-topic IMHO.
    – Friedrich
    Dec 29, 2023 at 15:48
  • 1
    @VivianDeSmedt sorry got caught up in work I am using ruff for now.
    – Sid
    Dec 31, 2023 at 12:02
  • 1
    @VivianDeSmedt Thank you for your time. i will follow your instructions and get back to you by the end of the weekend. A little busy right now. Don't want to break the editor again.
    – Sid
    Dec 31, 2023 at 13:10

1 Answer 1

1

The formatters (black) in particular iare confused when the syntax is not correct.

I would try first to correct the syntax first.

From:

dep helper(start):

To:

def helper(start):

Remark: I have tried your example and I can confirm that black is confused by the dep syntax error and refuse the format the code.

4
  • I tried with def too. It just wont format. I uninstalled and installed ruff again. Ruff is working for me. But not sure why black is not
    – Sid
    Dec 29, 2023 at 13:59
  • Thanks for the feedback. What is the output of :!black %? Dec 29, 2023 at 14:20
  • 1
    I have uninstalled black for now. i will install it again and get back to you tomorrow
    – Sid
    Dec 29, 2023 at 14:23
  • 1
    If you are ready to undo your change you can also do: :%!black -. It will add at the end of your file the error message generated by black. If you hit u the change (i.e. the error message) will be removed. Dec 29, 2023 at 14:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.