@@ -456,6 +456,8 @@ def format_code(self, code: str, notebook: bool, args: List[str] = [], **options
456
456
457
457
458
458
class RuffFixFormatter (CommandLineFormatter ):
459
+ ruff_args = ["check" , "-eq" , "--fix-only" , "-" ]
460
+
459
461
@property
460
462
def label (self ) -> str :
461
463
return f"Apply ruff Formatter"
@@ -467,7 +469,11 @@ def __init__(self):
467
469
ruff_command = find_ruff_bin ()
468
470
except (ImportError , FileNotFoundError ):
469
471
ruff_command = "ruff"
470
- self .command = [ruff_command , "check" , "--fix-only" , "-" ]
472
+ self .command = [ruff_command , * self .ruff_args ]
473
+
474
+
475
+ class RuffFormatFormatter (RuffFixFormatter ):
476
+ ruff_args = ["format" , "-q" , "-" ]
471
477
472
478
473
479
SERVER_FORMATTERS = {
@@ -477,6 +483,7 @@ def __init__(self):
477
483
"yapf" : YapfFormatter (),
478
484
"isort" : IsortFormatter (),
479
485
"ruff" : RuffFixFormatter (),
486
+ "ruffformat" : RuffFormatFormatter (),
480
487
"formatR" : FormatRFormatter (),
481
488
"styler" : StylerFormatter (),
482
489
"scalafmt" : CommandLineFormatter (command = ["scalafmt" , "--stdin" ]),
0 commit comments