Skip to content

Document Pyrefly usage in Zed#227

Merged
mrobinson merged 2 commits intoservo:mainfrom
freyacodes:patch-2
Apr 15, 2026
Merged

Document Pyrefly usage in Zed#227
mrobinson merged 2 commits intoservo:mainfrom
freyacodes:patch-2

Conversation

@freyacodes
Copy link
Copy Markdown
Contributor

Adds instructions for enabling the Pyrefly LSP in Servo.

The change to yaml formatting is to not highlight the JSON comment as an error

Copy link
Copy Markdown
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just a few comments:

Comment thread src/contributing/editor-setup.md Outdated
Comment thread src/contributing/editor-setup.md Outdated
"Python": {
"language_servers": ["pyrefly", "!pyright", "!pylsp"],
},
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. If this is a separate extension that isn't the default Python extension, maybe it makes sense to put this in a new block with a small introduction like:

The Pyrefly Zed extension allows for static checking type checking when working with Python code. If you want to you this extension you use it for Servo with the following configuration:

{
  "lsp": {
    "pyrefly": {
      "binary": {
        "path": ".venv/bin/pyrefly",
        "arguments": ["lsp"],
      },
      "settings": {
        "python": {
          "pythonPath": ".venv/bin/python",
        },
        "pyrefly": {
          "project_includes": ["python/**/*.py"],
          "project_excludes": ["**/.[!/.]*", "**/*venv/**"],
          "search_path": ["python"],
          "ignore_errors_in_generated_code": true,
        },
      },
    },
  },
  "languages": {
    "Python": {
      "language_servers": ["pyrefly", "!pyright", "!pylsp"],
    },
  },
}

@freyacodes
Copy link
Copy Markdown
Contributor Author

The idea with using yaml highlighting was because YAML is a superset of JSON that supports comments (like the ones in Zed files). Either way, I agree that it makes sense to split it into a different code block.

Signed-off-by: Freya Arbjerg <git@arbjerg.dev>
@freyacodes
Copy link
Copy Markdown
Contributor Author

I've decided to rewrite the whole thing. I've added a bit more context and moved it to its own section.

I've also adjusted the actual configuration. The removed settings are instead provided by pyproject.toml.

Comment thread src/contributing/editor-setup.md Outdated
Comment thread src/contributing/editor-setup.md Outdated
Co-authored-by: Martin Robinson <martin@abandonedwig.info>
Signed-off-by: Martin Robinson <martin@abandonedwig.info>
@mrobinson mrobinson added this pull request to the merge queue Apr 15, 2026
Merged via the queue into servo:main with commit b1dff29 Apr 15, 2026
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.

2 participants