Formatting with Ruff Doesnt Work
Summary
Ruff formatter doesn't work. I've already installed the extension and configured it but it still doesn't work.
Description
Steps to reproduce:
- add settings.json
- Open a python file and tell zed to format it
Expected Behavior: Formatting works Actual Behavior: nothing happens
- Check your Zed.log for relevant errors? (please include!)
- Click Preview to ensure everything looks right?
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
"icon_theme": "Catppuccin Mocha",
"terminal": {
"dock": "bottom"
},
"ui_font_size": 16,
"buffer_font_size": 16,
"theme": {
"mode": "system",
"light": "One Light",
"dark": "One Dark Pro"
},
"buffer_font_features": {
"calt": false,
"liga": false,
"diga": false
},
"autosave": { "after_delay": { "milliseconds": 400 } },
"format_on_save": "on",
"languages": {
"Python": {
"format_on_save": "on",
"language_servers": ["ruff", "pyright"],
"formatter": [
{
"code_actions": {
"source.organizeImports.ruff": true,
"source.fixAll.ruff": true
}
}
],
"tab_size": 4
}
},
"soft_wrap": "editor_width",
"lsp": {
"ruff": {
"initialization_options": {
"settings": {
// Ruff server settings goes here
"lineLength": 80,
"lint": {
"extendSelect": ["I"]
}
}
}
}
}
}
Zed Version and System Specs
Zed: v0.185.14 (Zed) OS: Linux X11 linuxmint 22.1 Memory: 15.4 GiB Architecture: x86_64 GPU: NVIDIA GeForce RTX 3050 Ti Laptop GPU || NVIDIA || 570.133.07
Are you saying that to me? I don't think I can assign it to you, i dont have permissions for that
You're missing the formatter declaration telling us to use ruff for LSP formatting, instead of just code action formatting. Please add the following above in the "formatter" array for Python and @-mention me if that doesn't fix the issue for you so we can figure out what else may be going wrong
{
"language_server": {
"name": "ruff"
}
}
It seems to be definitely working, thanks a lot!