8000 [Backport M92] fix(auto-edit): use correct doc context version to show inline completions more often by sourcegraph-release-bot · Pull Request #7840 · sourcegraph/cody · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Backport M92] fix(auto-edit): use correct doc context version to show inline completions more often #7840

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

sourcegraph-release-bot
Copy link
Collaborator
  • Renamed docContext to predictionDocContext and requestDocContext to clearly differentiate between them in the code.
  • In vscode/src/autoedits/renderer/manager.ts, the getRenderOutput function used to rely on requestDocContext 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 the insertText not matching the text already in the document and being hidden by VS Code. This PR fixes the issue by removing the dependency on docContext entirely from this function. Instead, it now relies on the always up-to-date recomputed current line prefix and suffix.
  • Inlines the getAndProcessModelResponses body into getPrediction 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 typing struct on a new line:

struct Canvas {
    pub pixels: Vec,
    pub stride: u8,
    pub size: Size,
    pub format: Format,
}

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

…tions more often (#7837)

- Renamed `docContext` to `predictionDocContext` and `requestDocContext`
to clearly differentiate between them in the code.
- In `vscode/src/autoedits/renderer/manager.ts`, the `getRenderOutput`
function used to rely on `requestDocContext` 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 the `insertText` not matching the text already in the
document and being hidden by VS Code. This PR fixes the issue by
removing the dependency on `docContext` entirely from this function.
Instead, it now relies on the always up-to-date recomputed current line
prefix and suffix.
- Inlines the `getAndProcessModelResponses` body into `getPrediction` to
reduce the number of nested functions for easier debugging.

(cherry picked from commit 771de02)
@umpox umpox merged commit aea8f1d into M92 May 2, 2025
21 of 22 checks passed
@umpox umpox deleted the backport-7837-to-M92 branch May 2, 2025 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0