-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: never panic in LSP inlay hints (#5534)
# Description ## Problem I noticed that the inlay hint request would sometimes panic. This happens if the request happens when a source file is being edited but its cached version (in a FileMap) is not yet updated. Then, the editor might pass a line range that's bigger than what's cached... producing a panic. In reality, the panic comes from the `codespan_lsp` crate: a function we call returns `Result`, but there's an `unwrap()` inside it making it panic instead of returning a Result. ## Summary Here we don't depend on `codespan_lsp` for doing that, and instead copy the logic but never panic. ## Additional Context None. ## Documentation Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
3 changed files
with
65 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters