ruff/crates
Andrew Gallant d45209f425 [ty] Add some tricky test cases for the auto-import importer
We don't attempt to fix these yet. I think there are bigger fish to fry.

I came up with these based on this discussion:
https://github.com/astral-sh/ruff/pull/20439#discussion_r2357769518

Here's one example:

```
if ...:
    from foo import MAGIC
else:
    from bar import MAGIC

MAG<CURSOR>
```

Now in this example, completions will include `MAGIC` from the local
scope. That is, auto-import is involved with that completion. But at
present, auto-import will suggest importing `foo` and `bar` because we
haven't de-duplicated completions yet. Which is fine.

Here's another example:

```
if ...:
    import foo as fubar
else:
    import bar as fubar

MAG<CURSOR>
```

Now here, there is no `MAGIC` symbol in scope. So auto-import is in
play. Let's assume that the user selects `MAGIC` from `foo` in this
example. (`bar` also has `MAGIC`.)

Since we currently ignore the declaration site for symbols with
multiple possible bindings, the importer today doesn't know that
`fubar` _could_ contain `MAGIC`. But even if it did, what would we do
with that information? Should we do this?

```
if ...:
    import foo as fubar
    from foo import MAGIC
else:
    import bar as fubar

MAGIC
```

Or could we reason that `bar` also has `MAGIC`?

```
if ...:
    import foo as fubar
else:
    import bar as fubar

fubar.MAGIC
```

But if we did that, we're making an assumption of user intent, since
they *selected* `foo.MAGIC` but not `bar.MAGIC`.

Anyway, I don't think we need to settle on an answer today, but I
wanted to capture some of these tricky cases in tests at the very
least.
2025-09-19 07:54:07 -04:00
..
ruff Bump 0.13.1 (#20473) 2025-09-18 19:25:17 +00:00
ruff_annotate_snippets Move full diagnostic rendering to ruff_db (#19415) 2025-08-08 12:56:23 -04:00
ruff_benchmark [ty] Add support for **kwargs (#20430) 2025-09-19 05:00:30 +00:00
ruff_cache
ruff_db Bump MSRV to Rust 1.88 (#20470) 2025-09-18 17:52:37 +02:00
ruff_dev [ty] Remove duplicate global lint registry (#20053) 2025-08-22 19:43:12 -04:00
ruff_diagnostics Fix rust feature activation (#20012) 2025-08-21 09:26:06 +02:00
ruff_formatter Add support for using uv as an alternative formatter backend (#19665) 2025-09-09 20:39:53 +05:30
ruff_graph [ty] Remove KnownModule::is_enum (#19681) 2025-08-01 10:31:12 +02:00
ruff_index
ruff_linter [flake8-simplify] Fix incorrect fix for positive maxsplit without separator (SIM905) (#20056) 2025-09-18 20:56:34 +00:00
ruff_macros Don't cache files with diagnostics (#19869) 2025-08-12 15:28:44 -04:00
ruff_memory_usage [ty] Track heap usage of salsa structs (#19790) 2025-08-12 13:28:44 +02:00
ruff_notebook Improve diff rendering for notebooks (#20036) 2025-08-25 09:20:42 -04:00
ruff_options_metadata Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
ruff_python_ast Track t-strings and f-strings for token-based rules and suppression comments (#20357) 2025-09-12 13:00:12 -05:00
ruff_python_ast_integration_tests Disallow implicit concatenation of t-strings and other string types (#19485) 2025-07-27 12:41:03 +00:00
ruff_python_codegen Generator preferred quote style (#20434) 2025-09-18 12:57:21 +02:00
ruff_python_formatter Update rust toolchain to 1.90 (#20469) 2025-09-18 16:54:49 +02:00
ruff_python_importer [ruff] Add API for splicing into an existing import statement 2025-09-17 13:59:28 -04:00
ruff_python_index Track t-strings and f-strings for token-based rules and suppression comments (#20357) 2025-09-12 13:00:12 -05:00
ruff_python_literal
ruff_python_parser [syntax-errors]: import from * only allowed at module scope (F406) (#20166) 2025-09-16 15:53:28 -04:00
ruff_python_semantic [ruff] Allow dataclass attribute value instantiation from nested frozen dataclass (RUF009) (#20352) 2025-09-12 16:46:49 -04:00
ruff_python_stdlib
ruff_python_trivia [ruff] Preserve relative whitespace in multi-line expressions (RUF033) (#19647) 2025-08-27 19:15:44 +00:00
ruff_python_trivia_integration_tests
ruff_server Remove Diagnostic::expect_range and all consumers (#20322) 2025-09-10 17:19:20 -07:00
ruff_source_file Move diff rendering to ruff_db (#20006) 2025-08-21 09:47:00 -04:00
ruff_text_size [ruff] Add TextRange::to_std_range 2025-09-17 13:59:28 -04:00
ruff_wasm Bump 0.13.1 (#20473) 2025-09-18 19:25:17 +00:00
ruff_workspace [ruff] Add analyze.string-imports-min-dots to settings documentation (#20375) 2025-09-16 13:19:34 +02:00
ty [ty] Fix a bug with "all_submodule_names_for_package" API 2025-09-17 13:59:28 -04:00
ty_combine [ty] Disallow std::env and io methods in most ty crates (#20046) 2025-08-22 11:13:47 -07:00
ty_ide [ty] Add some tricky test cases for the auto-import importer 2025-09-19 07:54:07 -04:00
ty_project [ty] Add GitHub output format (#20358) 2025-09-17 09:50:25 -04:00
ty_python_semantic [ty] Add support for **kwargs (#20430) 2025-09-19 05:00:30 +00:00
ty_server Update rust toolchain to 1.90 (#20469) 2025-09-18 16:54:49 +02:00
ty_static [ty] Disallow std::env and io methods in most ty crates (#20046) 2025-08-22 11:13:47 -07:00
ty_test [ty] Add functions for revealing assignability/subtyping constraints (#20217) 2025-09-03 16:44:35 -04:00
ty_vendored [ty] More constraint set simplifications via simpler constraint representation (#20423) 2025-09-16 10:05:01 -04:00
ty_wasm [ty] Add new completion data to wasm bridge 2025-09-17 13:59:28 -04:00