[Backport M92] fix(auto-edit): use correct doc context version to show inline completions more often #7840
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.
docContext
topredictionDocContext
andrequestDocContext
to clearly differentiate between them in the code.vscode/src/autoedits/renderer/manager.ts
, thegetRenderOutput
function used to rely onrequestDocContext
to prepend the current line prefix to the inline completion insert text. However, if a user added any text after the completion started, and the current line prefix changed, it led to theinsertText
not matching the text already in the document and being hidden by VS Code. This PR fixes the issue by removing the dependency ondocContext
entirely from this function. Instead, it now relies on the always up-to-date recomputed current line prefix and suffix.getAndProcessModelResponses
body intogetPrediction
to reduce the number of nested functions for easier debugging.Test plan
Manually tested on a toy example
canvas.rs
. Create a new file and start typingstruct
on a new line:The expected result:
<img width="305" alt="Screenshot 2025-05-02 at 14 03 07" src="https://github.com/user-attachments/assets/343ecb5f-46d4-47a2-b402-c6ee764c3a1d" />
Backport 771de02 from #7837