mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
Use real file path when available in ruff server
(#11800)
## 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 https://github.com/astral-sh/ruff/issues/11751. ## Test Plan Ran the LSP on Windows. In the FastAPI repo, added: ```toml [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.
This commit is contained in:
parent
32ca704956
commit
ee1621b2f9
3 changed files with 13 additions and 9 deletions
|
@ -71,7 +71,7 @@ pub(crate) fn fix_all(
|
|||
result: LinterResult { error, .. },
|
||||
..
|
||||
} = ruff_linter::linter::lint_fix(
|
||||
query.virtual_file_path(),
|
||||
&query.virtual_file_path(),
|
||||
package,
|
||||
flags::Noqa::Enabled,
|
||||
UnsafeFixes::Disabled,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue