@@ -422,37 +422,20 @@ bundle for TextMate.
422422
423423## Zed
424424
425- Ruff is available as an extension for the Zed editor. To install it:
425+ Ruff support is now built into Zed (no separate extension required).
426426
427- 1 . Open the command palette with ` Cmd+Shift+P `
428- 1 . Search for "zed: extensions"
429- 1 . Search for "ruff" in the extensions list and click "Install"
427+ By default, Zed uses Ruff for formatting and linting.
430428
431- To configure Zed to use the Ruff language server for Python files, add the following
432- to your ` settings.json ` file:
433-
434- ``` json
435- {
436- "languages" : {
437- "Python" : {
438- "language_servers" : [" ruff" ]
439- // Or, if there are other language servers you want to use with Python
440- // "language_servers": ["pyright", "ruff"]
441- }
442- }
443- }
444- ```
445-
446- To configure the language server, you can provide the [ server settings] ( settings.md )
447- under the [ ` lsp.ruff.initialization_options.settings ` ] ( https://zed.dev/docs/configuring-zed#lsp ) key:
429+ To set up editor-wide Ruff options, provide the [ server settings] ( settings.md )
430+ under the [ ` lsp.ruff.initialization_options.settings ` ] ( https://zed.dev/docs/configuring-zed#lsp ) key of your ` settings.json ` file:
448431
449432``` json
450433{
451434 "lsp" : {
452435 "ruff" : {
453436 "initialization_options" : {
454437 "settings" : {
455- // Ruff server settings goes here
438+ // Ruff server settings go here
456439 "lineLength" : 80 ,
457440 "lint" : {
458441 "extendSelect" : [" I" ],
@@ -464,22 +447,14 @@ under the [`lsp.ruff.initialization_options.settings`](https://zed.dev/docs/conf
464447}
465448```
466449
467- You can configure Ruff to format Python code on-save by registering the Ruff formatter
468- and enabling the [ ` format_on_save ` ] ( https://zed.dev/docs/configuring-zed#format-on-save ) setting :
450+ [ ` format_on_save ` ] ( https://zed.dev/docs/configuring-zed# format- on-save) is enabled by default.
451+ You can disable it for Python by changing ` format_on_save ` in your ` settings.json ` file :
469452
470453``` json
471454{
472455 "languages" : {
473456 "Python" : {
474- "language_servers" : [" ruff" ],
475- "format_on_save" : " on" ,
476- "formatter" : [
477- {
478- "language_server" : {
479- "name" : " ruff"
480- }
481- }
482- ]
457+ "format_on_save" : " off"
483458 }
484459 }
485460}
@@ -492,40 +467,12 @@ You can configure Ruff to fix lint violations and/or organize imports on-save by
492467{
493468 "languages" : {
494469 "Python" : {
495- "language_servers" : [" ruff" ],
496- "format_on_save" : " on" ,
497- "formatter" : [
498- // Fix all auto-fixable lint violations
499- { "code_action" : " source.fixAll.ruff" },
470+ "code_actions_on_format" : {
500471 // Organize imports
501- { "code_action" : " source.organizeImports.ruff" }
502- ]
503- }
504- }
505- }
506- ```
507-
508- Taken together, you can configure Ruff to format, fix, and organize imports on-save via the
509- following ` settings.json ` :
510-
511- !!! note
512-
513- For this configuration, it is important to use the correct order of the code action and
514- formatter language server settings. The code actions should be defined before the formatter to
515- ensure that the formatter takes care of any remaining style issues after the code actions have
516- been applied.
517-
518- ``` json
519- {
520- "languages" : {
521- "Python" : {
522- "language_servers" : [" ruff" ],
523- "format_on_save" : " on" ,
524- "formatter" : [
525- { "code_action" : " source.fixAll.ruff" },
526- { "code_action" : " source.organizeImports.ruff" },
527- { "language_server" : { "name" : " ruff" } }
528- ]
472+ "source.organizeImports.ruff" : true ,
473+ // Fix all auto-fixable lint violations
474+ "source.fixAll.ruff" : true
475+ }
529476 }
530477 }
531478}
0 commit comments