Skip to content

Conversation

@MichaReiser
Copy link
Member

Summary

This PR refactors to_lsp_range, to_lsp_position, and to_text_size, and to_text_range return an Option
because the operations can fail if the document is a notebook and the notebook isn't open in the editor.

Test Plan

cargo test. I clicked around in VS Code

@MichaReiser MichaReiser added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Nov 6, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@MichaReiser MichaReiser marked this pull request as ready for review November 6, 2025 15:47
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

mypy_primer results

No ecosystem changes detected ✅

Memory usage changes were detected when running on open source projects
trio (https://github.com/python-trio/trio)
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`

sphinx (https://github.com/sphinx-doc/sphinx)
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
+ WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`

prefect (https://github.com/PrefectHQ/prefect)
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `GenericAlias < 'db >::variance_of_`
- WARN expected `heap_size` to be provided by Salsa query `ClassLiteral < 'db >::variance_of_`

@Gankra
Copy link
Contributor

Gankra commented Nov 6, 2025

Curse you LSP protocol notebook APIs!!!

Co-authored-by: Aria Desires <aria.desires@gmail.com>
@MichaReiser MichaReiser enabled auto-merge (squash) November 7, 2025 14:39
@MichaReiser MichaReiser merged commit 6cc3393 into main Nov 7, 2025
40 checks passed
@MichaReiser MichaReiser deleted the micha/lsp-fallible-range-conversion branch November 7, 2025 14:44
dcreager added a commit that referenced this pull request Nov 7, 2025
* origin/main:
  Remove duplicate preview tests for `FURB101` and `FURB103` (#21303)
  [ty] Add support for `Literal`s in implicit type aliases (#21296)
  [ty] Add missing `heap_size` to `variance_of` queries (#21318)
  [`pyupgrade`] Fix false positive on relative imports from local `.builtins` module (`UP029`) (#21309)
  [ty] Make range/position conversions fallible (#21297)
  Bump 0.14.4 (#21306)
  Fix main by using `infer_expression` (#21299)
  [ty] Understand legacy and PEP 695 `ParamSpec` (#21139)
  [ty] Discover site-packages from the environment that ty is installed in (#21286)
  [ty] Make special cases for `UnionType` slightly narrower (#21276)
  Require ignore 0.4.24 in `Cargo.toml` (#21292)
  [ty] Favour imported symbols over builtin symbols (#21285)
  docs: revise Ruff setup instructions for Zed editor (#20935)
  [ty] Update salsa (#21281)
  [syntax-error]: no binding for nonlocal  PLE0117 as a semantic syntax error (#21032)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants