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

Use real file path when available in ruff server #11800

Merged
merged 1 commit into from
Jun 8, 2024
Merged

Conversation

charliermarsh
Copy link
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 Something isn't working server Related to the LSP server labels Jun 8, 2024
Copy link
Contributor

github-actions bot commented Jun 8, 2024

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
20 checks passed
@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 Something isn't working server Related to the 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