-
Notifications
You must be signed in to change notification settings - Fork 209
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
Completion: fix bad trailing }
completion
#378
Conversation
The So instead, I'd see if we can fix this in the suffix matching logic only. WDYT? My initial idea here is that this should 100% be a case of "the completion matches the next line". The only way it doesn't is because the completion can not delete code and we always append the same line prefix whitespace (even though Claude doesn't know about). My two ideas are:
|
As we discussed with @philipp-spiess, this PR doesn't try to do anything about bracket counting and parsing and just aims to catch some narrow cases with single close bracket completion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one comment inline :)
Fixes bad completion case https://github.com/sourcegraph/cody/discussions/358#discussioncomment-6531096
After hours of catching corner cases, I think we can't rely on regexp-based
shouldIncludeClosingLine
logic here. Counting brackets doesn't provide much value when we don't know about the structure of the expression where we try to insert completions. This PR just tries to handle the simple case with an empty completion line with a closed bracket symbol and cut off this completion.@philipp-spiess I don't think I fully understand how this is possible, but unit tests tell me that completion should be cut off, but vscode manual test shows that this problem is still there. Let me know if you have a minute for a quick pair on this.
Test plan
}
completion (see original GitHub discussion thread for the example)}
compleation