languages: Respect tab_size in Ruff and CSS formatters#53773
Closed
jwchmodx wants to merge 1 commit intozed-industries:mainfrom
Closed
languages: Respect tab_size in Ruff and CSS formatters#53773jwchmodx wants to merge 1 commit intozed-industries:mainfrom
jwchmodx wants to merge 1 commit intozed-industries:mainfrom
Conversation
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>
|
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'. |
Contributor
Contributor
|
@cla-bot check |
|
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'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RuffLspAdapterwas missing aworkspace_configurationimplementation, so Zed'stab_sizesetting was never passed to the formatter. Addedworkspace_configurationthat reads the Python language'stab_sizeand sends it to Ruff asformat.indent-width. User LSP settings overrides are still respected viamerge_json_value_into.CssLspAdapter.workspace_configurationexisted but didn't include any format settings. Addedcss.format.tabSize,less.format.tabSize, andscss.format.tabSizederived from Zed'stab_sizefor the CSS language.Both fixes follow the same pattern already used by the YAML adapter (
AllLanguageSettings::get→.language(...).tab_size).Test plan
"tab_size": 2in Zed settings, open a Python file, run Ruff format → output should use 2-space indentation"tab_size": 2in Zed settings, open a CSS/Less/SCSS file, run formatter → output should use 2-space indentationlsp.ruff.settings.format.indent-widthoverrides still take precedenceFixes #47841
Fixes #51378
🤖 Generated with Claude Code