Skip to content

Use real file path when available in ruff server#11800

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

Use real file path when available in ruff server#11800
snowsignal merged 1 commit intomainfrom
charlie/ig

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
@github-actions
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
@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