Fix handling of completions when they don't go to the end of line #132
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.
Currently copilot.el assumes that the completion text will go all the way to the end of the line, but this is not always the case. When this happens it will lead to incorrectly deleting the text that used to be there. This will lead to unbalanced parens or quotes.
This PR fixes this by using the API's
:endproperty to determine where the end of the completed text should go.Example:
text given to copilot
copilot will return the text
world.With the current implementation this will be the result if the user accepts the completion:
After this PR, the result would be as expected:
This will resolve issues like #77 #62 #117