Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid panic if request position is out of mapper's range #186

Merged
merged 2 commits into from
Nov 5, 2021

Conversation

buzztaiki
Copy link
Contributor

Sometimes Emacs lsp-mode sends a request containing a position parameter before synchronizing with DidChangeTextDocument.
At that time, the mapper may not be able to find the stored position and panicked with unwrap.
This fix is to return Ok(None) instead of unwrap to avoid this case.

Perhaps this may fix the problem like a golang/go#48249 as well.

This PR includes commit of #184.

@tamasfe tamasfe merged commit 5a4900b into tamasfe:master Nov 5, 2021
@tamasfe
Copy link
Owner

tamasfe commented Nov 5, 2021

LGTM, thank you! This might fix the seemingly random panics such as reported in #142.

And sorry about the slow response.

@buzztaiki buzztaiki deleted the dont_panic branch November 5, 2021 17:15
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