-
-
Notifications
You must be signed in to change notification settings - Fork 16
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: Correctly pick whole file context #85
Conversation
I can fix it. I did not know what is the expected behavior, in fact your approach was how I started fixing the bug :-) I think I have stash somewhere still. |
912e7a4
to
cd56cd6
Compare
@Palm1r Pushed fixes. This PR is very similar to your PR, except that I make |
There are still semi-related problems, will fix these via separate PRs. |
context/DocumentContextReader.cpp
Outdated
if (i == endLine) { | ||
context += block.text().left(cursorPosition); | ||
auto text = block.text(); | ||
if (i == startLine && startCursorPosition >= 0) { |
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.
but seems startCursorPosition and endCursorPosition can be same
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.
just cursorPosition
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.
No, because the function does not know which cursor cursorPosition refers to. It may be referring to the start line, or it can refer to end line.
Currently the current line is duplicated in both "before" and "after" context. This is due to DocumentContextReader::readWholeFileAfter() picking the current line part of which has been already included into the "before" context.
cd56cd6
to
c6fca23
Compare
I've added handling for way more edge cases, and also appropriate tests. |
Currently the current line is duplicated in both "before" and "after" context. This is due to
DocumentContextReader::readWholeFileAfter()
picking the current line part of which has been already included into the "before" context.