Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions to enable auto formatting on Zed needs updating #13081

Closed
victorneo opened this issue Aug 23, 2024 · 1 comment · Fixed by #13082
Closed

Instructions to enable auto formatting on Zed needs updating #13081

victorneo opened this issue Aug 23, 2024 · 1 comment · Fixed by #13082
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@victorneo
Copy link

The existing setup instructions for enabling auto formatting with Ruff on Zed does not seem to work as of Zed version 0.149.5.

Current docs:

{
  "languages": {
    "Python": {
      "format_on_save": "on",
      "formatter": [
        {
          "code_actions": {
            "source.organizeImports.ruff": true,
            "source.fixAll.ruff": true
          }
        },
        {
          "language_server": {
            "name": "ruff"
          }
        }
      ]
    }
  }
}

The above configuration no longer work, and after some tinkering with Zed's configuration options, this updated config now works for me by moving code_actions one level higher and changing it to code_actions_on_format:

{
  "languages": {
    "Python": {
      "format_on_save": "on",
      "language_servers": ["ruff"],
      "formatter": {
        "language_server": {
          "name": "ruff"
        }
      },
      "code_actions_on_format": {
        "source.fixAll.ruff": true,
        "source.organizeImports.ruff": true
      }
    }
  }
}
@dhruvmanila
Copy link
Member

Oh, I see the problem. Nothing in Zed has changed but the way I structured the docs is a bit confusing. The first code block includes the language_servers key but the following code blocks doesn't. I think I did this because I wanted the latter code blocks to just focus on the formatting side of the things. I see how this could be confusing. Do you want to update them? They're at https://github.com/astral-sh/ruff/blob/2d5fe9a6d3c837333e23b0a9b9d235bc338d91f6/docs/editors/setup.md#zed

@dhruvmanila dhruvmanila added documentation Improvements or additions to documentation good first issue Good for newcomers labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants