ruff-pycharm-plugin: Ruff not running on Reformat Code command
Describe the bug
With the “Run ruff when Reformat Code” option is checked, ruff format is not used over the default PyCharm formatter.
To Reproduce Steps to reproduce the behavior:
- Enable “Run ruff when Reformat Code” and ensure a ruff executable is picked (for me it was in my local virtual environment)
- Use Ctrl/Command + Alt + L or the “Reformat Code” menu option to trigger a code reformat
- Notice that ruff was not used to reformat the code and instead the built-in PyCharm formatter was used
Expected behavior Ruff should have been used to format the code. You can tell the difference by manually running ruff from the CLI.
Screenshots If applicable, add screenshots to help explain your problem. Also, gif movies are recommended.
Environments (please complete the following information):
- IDE: PyCharm Professional 2023.3
- OS: Windows and macOS
- Ruff Version 0.1.7
- Plugin version 0.0.27
Additional context Python 12
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 1
- Comments: 18 (6 by maintainers)
@hgalytoby I can’t reproduce your problem. Have you enabled the
Use ruff format ...option in the settings?I am experiencing the same issue. Here is a gif to show what is occurring.
Thank you, it’s working now.
Updated ruff to 0.2.2 and plugin to 0.0.29, and it seems to work for me. Thanks!
@koxudaxi, whoops, somehow missed the reply? I have tried enabling the LSP server setting, and got an error once that Intellij couldn’t stop the language server because it didn’t exist. Not sure if that’s related to this. Also not sure what triggered it, I think I had just restarted pycharm after an unrelated error?
I use windows, I can give you the full information tomorrow.
This still doesn’t work for me. I’m using plugin version 0.0.30, ruff version 0.3.2 and PyCharm 2023.3.4 in Ubuntu. My settings are the same as in your screenshot above.
Hi all, I’ve recently started using ruff (0.2.2) and I’ve also installed the ruff plugins (0.0.27).
I Reformat is not working, but lint is.
Mmh, strange I still don’t see ruff working.
Hi @koxudaxi , thank you for the tool.
I am not sure if it is the same problem, but here is the crash log (happens on every IDE start):
currently I have ruff==0.1.10 and plugin==0.0.19
Edit: this error seems to be duplicate of https://github.com/koxudaxi/ruff-pycharm-plugin/issues/329#issuecomment-1887068669