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

fix: add a safety check in lsp check_if_should_wrap #1459

Merged
merged 2 commits into from
May 16, 2024

Conversation

hugocaillard
Copy link
Collaborator

Description

In some rare cases, eg: if the LSP state isn't up to date, it's possible that the cursor position is past the end of the line (as the LSP sees it).

This PR adds a safety check before getting the beginning of the line with line[..position.character as usize].
This PR also slightly refactor this method

Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 40.72%. Comparing base (fdb3b3f) to head (43085cc).

Files Patch % Lines
...ents/clarity-lsp/src/common/requests/completion.rs 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1459      +/-   ##
==========================================
+ Coverage   40.71%   40.72%   +0.01%     
==========================================
  Files          87       87              
  Lines       32405    32404       -1     
==========================================
+ Hits        13193    13197       +4     
+ Misses      19212    19207       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hugocaillard hugocaillard merged commit 9c4bfdb into main May 16, 2024
19 checks passed
@hugocaillard hugocaillard deleted the fix/safe-check-on-should-wrap branch May 16, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants