-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Consider virtual path for various server actions #18910
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
Conversation
|
|
The diagnostics remain even after I close the interactive window: TODO: Currently debugging |
Ugh, it seems that VS Code is not sending the request in the order that we would get for other notebook documents. When I close the interactive window, I get the following two requests: Here, VS Code first sends the request to close the notebook document, so we remove it from the internal index. And, then when it sends us the request to close the cell document, we fail because the notebook document doesn't exists in the index: ruff/crates/ruff_server/src/session/index.rs Line 248 in 7f5d7b5
But, when I close a regular Jupyter Notebook ( |
|
Discussing this internally, I think the above mentioned inconsistency can be fixed in a separate PR as it isn't related to the issue. |
|
Thanks for looking into this issue |
* main: [ty] Fix false positives when subscripting an object inferred as having an `Intersection` type (#18920) [`flake8-use-pathlib`] Add autofix for `PTH202` (#18763) [ty] Add relative import completion tests [ty] Clarify what "cursor" means [ty] Add a cursor test builder [ty] Enforce sort order of completions (#18917) [formatter] Fix missing blank lines before decorated classes in .pyi files (#18888) Apply fix availability and applicability when adding to `DiagnosticGuard` and remove `NoqaCode::rule` (#18834) py-fuzzer: allow relative executable paths (#18915) [ty] Change `environment.root` to accept multiple paths (#18913) [ty] Rename `src.root` setting to `environment.root` (#18760) Use file path for detecting package root (#18914) Consider virtual path for various server actions (#18910) [ty] Introduce `UnionType::try_from_elements` and `UnionType::try_map` (#18911) [ty] Support narrowing on `isinstance()`/`issubclass()` if the second argument is a dynamic, intersection, union or typevar type (#18900) [ty] Add decorator check for implicit attribute assignments (#18587) [`ruff`] Trigger `RUF037` for empty string and byte strings (#18862) [ty] Avoid duplicate diagnostic in unpacking (#18897) [`pyupgrade`] Extend version detection to include `sys.version_info.major` (`UP036`) (#18633) [`ruff`] Frozen Dataclass default should be valid (`RUF009`) (#18735)
Summary
Ref: #14820 (comment)
This PR fixes a bug where virtual paths or any paths that doesn't exists on the file system weren't being considered for checking inclusion / exclusion. This was because the logic used
file_pathwhich returnsNonefor those path. This PR fixes that by using thevirtual_file_pathmethod that returns aPathcorresponding to the actual file on disk or any kind of virtual path.This should ideally just fix the above linked issue by way of excluding the documents representing the interactive window because they aren't in the inclusion set. It failed only on Windows previously because the file path construction would fail and then Ruff would default to including all the files.
Test Plan
On my machine, the
.interactivepaths are always excluded so I'm using the inclusion set instead:{ "ruff.nativeServer": "on", "ruff.path": ["/Users/dhruv/work/astral/ruff/target/debug/ruff"], "ruff.configuration": { "extend-include": ["*.interactive"] } }The diagnostics are shown for both the file paths and the interactive window:
And, the logs:
And, when using
ruff.excludevia:{ "ruff.exclude": ["*.interactive"] }With logs: