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