Skip to content

languages: Respect tab_size in Ruff and CSS formatters#53773

Closed
jwchmodx wants to merge 1 commit intozed-industries:mainfrom
jwchmodx:fix/respect-tab-size-in-ruff-css-formatters
Closed

languages: Respect tab_size in Ruff and CSS formatters#53773
jwchmodx wants to merge 1 commit intozed-industries:mainfrom
jwchmodx:fix/respect-tab-size-in-ruff-css-formatters

Conversation

@jwchmodx
Copy link
Copy Markdown

Summary

  • Ruff (Python, Formatter ignores tab size on python code #47841): RuffLspAdapter was missing a workspace_configuration implementation, so Zed's tab_size setting was never passed to the formatter. Added workspace_configuration that reads the Python language's tab_size and sends it to Ruff as format.indent-width. User LSP settings overrides are still respected via merge_json_value_into.
  • CSS/Less/SCSS (CSS formatting cannot be configured #51378): CssLspAdapter.workspace_configuration existed but didn't include any format settings. Added css.format.tabSize, less.format.tabSize, and scss.format.tabSize derived from Zed's tab_size for the CSS language.

Both fixes follow the same pattern already used by the YAML adapter (AllLanguageSettings::get.language(...).tab_size).

Test plan

  • Set "tab_size": 2 in Zed settings, open a Python file, run Ruff format → output should use 2-space indentation
  • Set "tab_size": 2 in Zed settings, open a CSS/Less/SCSS file, run formatter → output should use 2-space indentation
  • Verify that explicit lsp.ruff.settings.format.indent-width overrides still take precedence

Fixes #47841
Fixes #51378

🤖 Generated with Claude Code

Pass Zed's tab_size setting to Ruff as `format.indent-width` and to the
vscode-css-language-server as `css/less/scss.format.tabSize`, so that
formatter output matches the editor's configured indentation width.

Fixes zed-industries#47841 (Ruff ignores tab size on Python code)
Fixes zed-industries#51378 (CSS formatting cannot be configured)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 13, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @jwchmodx on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@maxdeviant maxdeviant changed the title fix(languages): respect tab_size in Ruff and CSS formatters languages: Respect tab_size in Ruff and CSS formatters Apr 13, 2026
@zed-industries-bot
Copy link
Copy Markdown
Contributor

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 2f61dc6

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

@cla-bot check

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 29, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @jwchmodx on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 29, 2026

The cla-bot has been summoned, and re-checked this pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS formatting cannot be configured Formatter ignores tab size on python code

3 participants