mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +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
|
@ -113,7 +113,7 @@ pub(crate) fn check(query: &DocumentQuery, encoding: PositionEncoding) -> Diagno
|
|||
|
||||
// Generate checks.
|
||||
let LinterResult { data, .. } = check_path(
|
||||
query.virtual_file_path(),
|
||||
&query.virtual_file_path(),
|
||||
package,
|
||||
&locator,
|
||||
&stylist,
|
||||
|
@ -127,7 +127,7 @@ pub(crate) fn check(query: &DocumentQuery, encoding: PositionEncoding) -> Diagno
|
|||
);
|
||||
|
||||
let noqa_edits = generate_noqa_edits(
|
||||
query.virtual_file_path(),
|
||||
&query.virtual_file_path(),
|
||||
data.as_slice(),
|
||||
&locator,
|
||||
parsed.comment_ranges(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue