Skip to content

Use real file path when available in ruff server - #11800

Merged
snowsignal merged 1 commit into
mainfrom
charlie/ig
Jun 8, 2024
Merged

snowsignal merged 1 commit into
mainfrom
charlie/ig

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

Summary

As-is, we're using the URL path for all files, leading us to use paths like:

/c%3A/Users/crmar/workspace/fastapi/tests/main.py

This doesn't match against per-file ignores and other patterns in Ruff configuration.

This PR modifies the LSP to use the real file path if available, and the virtual file path if not.

Closes #11751.

Test Plan

Ran the LSP on Windows. In the FastAPI repo, added:

[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["F401"]

And verified that an unused import was ignored in tests after this change, but not before.

@charliermarsh charliermarsh added bug An issue describing something that isn't working, or a PR that fixes a bug server Related to the Ruff or ty LSP server labels Jun 8, 2024
@github-actions

github-actions Bot commented Jun 8, 2024

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@snowsignal
snowsignal merged commit ee1621b into main Jun 8, 2024
@snowsignal
snowsignal deleted the charlie/ig branch June 8, 2024 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug server Related to the Ruff or ty LSP server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lint.per-file-ignores option is ignored by the new language server

2 participants