ruff/crates
Dhruv Manilawala 6f4db8675b
[red-knot] Add support for untitled files (#12492)
## Summary

This PR adds support for untitled files in the Red Knot project.

Refer to the [design
discussion](https://github.com/astral-sh/ruff/discussions/12336) for
more details.

### Changes
* The `parsed_module` always assumes that the `SystemVirtual` path is of
`PySourceType::Python`.
* For the module resolver, as suggested, I went ahead by adding a new
`SystemOrVendoredPath` enum and renamed `FilePathRef` to
`SystemOrVendoredPathRef` (happy to consider better names here).
* The `file_to_module` query would return if it's a
`FilePath::SystemVirtual` variant because a virtual file doesn't belong
to any module.
* The sync implementation for the system virtual path is basically the
same as that of system path except that it uses the
`virtual_path_metadata`. The reason for this is that the system
(language server) would provide the metadata on whether it still exists
or not and if it exists, the corresponding metadata.

For point (1), VS Code would use `Untitled-1` for Python files and
`Untitled-1.ipynb` for Jupyter Notebooks. We could use this distinction
to determine whether the source type is `Python` or `Ipynb`.

## Test Plan

Added test cases in #12526
2024-07-26 18:13:31 +05:30
..
red_knot [red-knot] remove wrong __init__.py from file-watching tests (#12519) 2024-07-26 07:14:01 +01:00
red_knot_module_resolver [red-knot] Add support for untitled files (#12492) 2024-07-26 18:13:31 +05:30
red_knot_python_semantic [red-knot] handle all syntax without panic (#12499) 2024-07-25 17:38:08 -07:00
ruff Bump version to 0.5.5 (#12510) 2024-07-25 20:17:01 +05:30
ruff_benchmark Remove criterion/codspeed compat layer (#12524) 2024-07-26 12:22:16 +02:00
ruff_cache Fix cache key collisions for paths with separators (#12159) 2024-07-03 07:36:46 -05:00
ruff_db [red-knot] Add support for untitled files (#12492) 2024-07-26 18:13:31 +05:30
ruff_dev Drop deprecated `nursery` rule group (#10172) 2024-06-27 13:44:11 +02:00
ruff_diagnostics Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_formatter Use `indentation` consistently (#12293) 2024-07-12 14:08:56 +02:00
ruff_index [red-knot] small efficiency improvements and bugfixes to use-def map building (#12373) 2024-07-18 09:24:58 -07:00
ruff_linter [`pydoclint`] Add `docstring-missing-returns` amd `docstring-extraneous-returns` (`DOC201`, `DOC202`) (#12485) 2024-07-26 06:36:00 +00:00
ruff_macros Drop deprecated `nursery` rule group (#10172) 2024-06-27 13:44:11 +02:00
ruff_notebook [red-knot] Add notebook support (#12338) 2024-07-17 08:26:33 +00:00
ruff_python_ast [red-knot] Add notebook support (#12338) 2024-07-17 08:26:33 +00:00
ruff_python_ast_integration_tests Rename `PreorderVisitor` to `SourceOrderVisitor` (#11798) 2024-06-07 17:01:58 +00:00
ruff_python_codegen Use `indentation` consistently (#12293) 2024-07-12 14:08:56 +02:00
ruff_python_formatter Fix incorrect placement of leading function comment with type params (#12447) 2024-07-22 14:17:00 +02:00
ruff_python_index Enable token-based rules on source with syntax errors (#11950) 2024-07-02 08:57:46 +00:00
ruff_python_literal Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_parser Raise syntax error for unparenthesized generator expr in multi-argument call (#12445) 2024-07-22 14:44:20 +05:30
ruff_python_resolver chore(deps): update rust crate insta to v1.38.0 (#10701) 2024-04-01 15:44:30 +00:00
ruff_python_semantic Ignore `NPY201` inside `except` blocks for compatibility with older numpy versions (#12490) 2024-07-24 20:03:23 +00:00
ruff_python_stdlib Regenerate sys.rs with stdlibs==2024.5.15 (#11437) 2024-05-15 22:17:32 +00:00
ruff_python_trivia Mention that `Cursor` is based on rustc's implementation. (#12109) 2024-06-30 16:53:25 +01:00
ruff_python_trivia_integration_tests Build `CommentRanges` outside the parser (#11792) 2024-06-09 09:55:17 +00:00
ruff_server Do not bail code action resolution when a quick fix is requested (#12462) 2024-07-23 10:30:03 +05:30
ruff_source_file red-knot: `source_text`, `line_index`, and `parsed_module` queries (#11822) 2024-06-13 07:37:02 +00:00
ruff_text_size Upgrade to Rust 1.79 (#11875) 2024-06-17 07:15:10 +01:00
ruff_wasm Bump version to 0.5.5 (#12510) 2024-07-25 20:17:01 +05:30
ruff_workspace Update docs Settings output-format default (#12409) 2024-07-19 17:51:46 +00:00