Autocomplete: Remove same line suffix information from ollama prompts #3213
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.
This PR removes the same line suffix information in the ollama prompts. This is going to make it possible to have insertion in the middle of text in the current line.
The issue without that is that we currently do not have a way for yielded completion results to know wether they contain the same line suffix or not. We treat all completions as though they do (so a completion of
console.log(|)
will always include the closing)
) and if there's no overlap with the current suffix we filter them out. This logic is because in the past, models weren't good enough to deal the same line suffix.The quick fix is to make sure we also omit the same line suffix info for Ollama prompts and have the model generate the suffix again so we can properly diff it.
Before
Test plan
After