feat: offer string literal completions always when expected type of e…#2
Conversation
…xpression is string literal
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc193c23ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Type::Union(union) => { | ||
| for ty in union.elements(db) { | ||
| let Type::TypedDict(typed_dict) = *ty else { | ||
| return None; | ||
| }; |
There was a problem hiding this comment.
Preserve TypedDict key completions for mixed unions
The new expected_subscript_slice_type returns None as soon as it encounters a union member that isn’t a TypedDict. Since completions now require an expected type, this suppresses key literal suggestions for common cases like TypedDict | None or TypedDict | Mapping, even though the old collect_typed_dict_key_literals logic would still surface keys from the typed‑dict members. That’s a regression in completion coverage for valid typed‑dict access patterns. Consider collecting keys from any typed‑dict members (and skipping non‑typed‑dict ones) instead of bailing out.
Useful? React with 👍 / 👎.
…xpression is string literal
Summary
Test Plan