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: range create error #584

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

kanej
Copy link
Member

@kanej kanej commented Jul 9, 2024

If the import completion is triggered by deleting a quote on an existing import and readding it then, the position is the start of the import but we delete the entire length of the import line which creates a negative position triggering the bug.

Instead, we short circuit. If the import is already the suggestion we don't suggest it again.

Fixes #150.

@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Jul 9, 2024
@antico5
Copy link
Collaborator

antico5 commented Feb 25, 2025

@kanej should I rebase and merge this ?

@kanej
Copy link
Member Author

kanej commented Feb 26, 2025

@kanej should I rebase and merge this ?

Can you rebase this. I added this as a draft as I stumbled over the recreation steps for it while testing something else. I quickly put together a fix while it was fresh in my mind - but without the time to work through in detail.

So the current state is, we can reproduce the range create error bug with the steps in the descriptions. I have what appears to be a fix.

Basically, I think the next steps are:

  1. Recreate locally
  2. Figure out how we should fix this properly (reuse this draft if useful or ignore otherwise)
  3. Test and review as normal

If the import completion is triggered by deleting a quote on an existing
import and readding it then, the position is the start of the import but
we delete the entire length of the import line which creates a negative
position triggering the bug.

Instead, we short circuit. If the import is already the suggestion we
don't suggest it again.

Fixes #150.
@antico5 antico5 force-pushed the fix/range-exception-on-bad-input branch from 232974a to 058680e Compare February 26, 2025 19:48
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

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

Project coverage is 54.49%. Comparing base (e5372f3) to head (058680e).

Files with missing lines Patch % Lines
...ver/src/frameworks/Hardhat/getImportCompletions.ts 0.00% 5 Missing ⚠️
...src/services/completion/getImportPathCompletion.ts 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development     #584      +/-   ##
===============================================
- Coverage        54.52%   54.49%   -0.04%     
===============================================
  Files              226      226              
  Lines             5199     5202       +3     
  Branches           800      801       +1     
===============================================
  Hits              2835     2835              
- Misses            2127     2129       +2     
- Partials           237      238       +1     

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

@antico5
Copy link
Collaborator

antico5 commented Feb 26, 2025

@kanej just rebased and reproduced the original issue. Your PR effectively solves the problem, so it's good to go on our merge backlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Range exceptioning on bad inputs
3 participants