Skip to content

fix: improve findSearchMatch to fix whitespace matching errors #6816

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sestinj
Copy link
Contributor

@sestinj sestinj commented Jul 27, 2025

Description

There were previously incorrect ranges being returned in cases where we had to fall back to the whitespace matcher, mangling files. This tests that further and addresses the problems.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Tests

Primarily this PR creates additional tests to check each of the fallback methods


Summary by cubic

Fixed incorrect whitespace matching in findSearchMatch, preventing file mangling and improving accuracy for edge cases.

  • Bug Fixes
    • Updated trimmedMatch to handle surrounding whitespace correctly.
    • Improved handling of empty and whitespace-only search content.
    • Added comprehensive tests for all matching strategies and edge cases.

@sestinj sestinj requested a review from a team as a code owner July 27, 2025 20:24
@sestinj sestinj requested review from tingwai and removed request for a team July 27, 2025 20:24
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jul 27, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 1 file. Review in cubic

@Patrick-Erichsen
Copy link
Collaborator

@sestinj opened #6825 to ignore the lint error on max-lines-per-function in your test file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants