Skip to content

Conversation

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Jul 25, 2024

Summary

This PR adds the setup documentation for using Ruff with the Zed editor.

Closes: #12388

@dhruvmanila dhruvmanila added the documentation Improvements or additions to documentation label Jul 25, 2024
@dhruvmanila dhruvmanila enabled auto-merge (squash) July 25, 2024 13:06
@dhruvmanila dhruvmanila merged commit 6bbb4a2 into main Jul 25, 2024
@dhruvmanila dhruvmanila deleted the dhruv/zed-setup branch July 25, 2024 13:09
@samueller
Copy link

I've read the setup docs, but still can't figure out how to add linting options. For example, where in Zed's settings.json do I add the option for quote-style? The docs give examples for pyproject.toml and ruff.toml and I've tried many possible places in settings.json, but can't figure it out.

@MichaReiser
Copy link
Member

@samueller sorry that you're struggling with this.

The editor doesn't support all ruff settings. It only supports a subset and quote-style isn't part of that subset. To configure the quote-style, you have to create a pyproject.toml or ruff.toml and set the quote style in there.

@samueller
Copy link

It only supports a subset and quote-style isn't part of that subset.

I understand, thank you for letting me know

@dhruvmanila
Copy link
Member Author

@samueller Sorry that you struggled with this. Do you have any recommendation on how can we improve this in the documentation to make it clearer?

@samueller
Copy link

@samueller Do you have any recommendation on how can we improve this in the documentation to make it clearer?

Would have been great to have read which subset of features work in Zed's settings.json and which don't in the Zed configuration section.

@dhruvmanila
Copy link
Member Author

dhruvmanila commented Aug 23, 2024

Would have been great to have read which subset of features work in Zed's settings.json and which don't in the Zed configuration section.

I'm curious to know whether the following section in https://docs.astral.sh/ruff/editors/setup/#zed conveys this:

To configure the language server, you can provide the server settings under the lsp.ruff.initialization_options.settings key:

{
  "lsp": {
    "ruff": {
      "initialization_options": {
        "settings": {
          // Ruff server settings goes here
          "lineLength": 80,
          "lint": {
            "extendSelect": ["I"],
          }
        }
      }
    }
  }
}

@samueller
Copy link

I'm curious to know whether the following section in https://docs.astral.sh/ruff/editors/setup/#zed conveys this:

I had seen that, but it didn't tell me the settings that won't work, such as quote-reply. I had assumed all settings would work, I just needed to figure out how to specify them in settings.json.

@dhruvmanila
Copy link
Member Author

I see, thanks for the insight. I think it makes sense to explicitly clarify this point in the docs.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ruff LSP Setup Guide for Zed

5 participants