edit_prediction: Fix special token check matching ======= inside comments#52510
Merged
osyvokon merged 4 commits intozed-industries:mainfrom Mar 31, 2026
Conversation
…mments The check used `contains()` which would match `=======\n` anywhere in the buffer, including inside comments like `// =======`. Now it only matches when the token is at the start of a line. Fixes zed-industries#52489
osyvokon
reviewed
Mar 30, 2026
special tokens ending with \n (like '=======\n') now match only when they occupy an entire line, preventing false positives in comments with separator characters
osyvokon
reviewed
Mar 31, 2026
…r line 229 Removed the text_contains_line_start_token function and its associated tests to simplify the codebase
Contributor
Author
|
Removed the unused code as well as the test near the end👍 |
Contributor
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52489
The special token check in
prompt_input_contains_special_tokensusedString::contains()to look for=======\nin the buffer. This meant any line containing=======(like// =======section separators) would cause edit predictions to bail out entirely.Fixed by only matching when the token appears at the start of a line, since the git merge markers are always placed at line boundaries in the prompt.
Added tests for both the helper function and a regression test for the reported issue.