Skip to content

Improve collections typing#193

Merged
deathaxe merged 2 commits intomasterfrom
fix/collections-typing
Feb 13, 2026
Merged

Improve collections typing#193
deathaxe merged 2 commits intomasterfrom
fix/collections-typing

Conversation

@deathaxe
Copy link
Member

@deathaxe deathaxe commented Jan 30, 2026

This PR attempts to somewhat improve type hints of functions from _utils.collections module.

To avoid circular imports, Value definition is moved from settings_dict to _utils.collections.

Calls of get_selector etc. are marked # type: ignore as SettingsDict doesn't fully implement Mapping protocol.

As usage of `Value` is gated by `TYPE_CHECKING` and disabled evaluation of
annotations, it is safe to use sublime_types.Value without breaking runtime
code of ST builds before 4135. It would just be type checkers, complaining
about missing imports, when executed on such old builds, which is considered
acceptable in favor of less duplicate definitions.

FWIW, it has already been used by window_utils, this way.
@deathaxe deathaxe merged commit 3c5a363 into master Feb 13, 2026
1 check passed
@deathaxe deathaxe deleted the fix/collections-typing branch February 13, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants