Skip to content

fix(vscode): stop autocomplete firing in non-code input boxes (#12933)#12942

Open
minh2416294 wants to merge 1 commit into
continuedev:mainfrom
minh2416294:fix/12933-autocomplete-non-code-input-schemes
Open

fix(vscode): stop autocomplete firing in non-code input boxes (#12933)#12942
minh2416294 wants to merge 1 commit into
continuedev:mainfrom
minh2416294:fix/12933-autocomplete-non-code-input-schemes

Conversation

@minh2416294

Copy link
Copy Markdown

Description

Continue's VS Code inline autocomplete was firing inside other extensions' text input boxes - the reporter saw it autocomplete into the GitHub Copilot Chat input (#12933).

Root cause: the inline completion provider is registered with a catch-all document selector [{ pattern: "**" }] (extensions/vscode/src/extension/VsCodeExtension.ts), so VS Code invokes it for every document, including foreign chat/comment/output input boxes. The handler provideInlineCompletionItems only returned early for the vscode-scm scheme, so it had no general guard against non-code input surfaces. The Copilot Chat input is a real TextDocument with URI scheme chatSessionInput, which slipped through and received completions.

Fix: add a small handler-side guard that returns early for known non-code input schemes, extracted into a testable isNonCodeInputScheme() helper. The existing vscode-scm bail is folded into the same denylist (behavior-preserving).

I kept this as a scheme denylist rather than narrowing the registration selector to an allowlist, because an allowlist would risk silently regressing document types that work today - vscode-remote (SSH/WSL/Codespaces), vscode-vfs (github.dev), untitled buffers, and notebook cells. This also mirrors how VS Code's own Copilot completions guard their chat input by scheme, and matches existing scheme-guarding precedent in this repo (InlineTipManager, NextEditWindowManager, ideUtils)

Checklist

  • I've read the contributing guide

  • The relevant docs, if any, have been updated or created (n/a — internal behavior fix)

  • The relevant tests, if any, have been updated or created.

Tests

Added unit tests in ContinueCompletionProvider.vitest.ts:

  • isNonCodeInputScheme returns true for each denied scheme (vscode-scm, comment, chatSessionInput, vscode-interactive-input, vscode-chat-editor, chat-editing-text-model, output, vscode-settings) and false for real editable schemes (file, vscode-remote, untitled, vscode-notebook-cell, vscode-vfs).

  • The provider returns null and does not start a completion chain for each denied scheme (parametrized), with a named case for the chatSessionInput scheme that reproduces Continue writes into Copilot Chat input #12933.

  • The existing "starts a new chain" test on a file:// document acts as the positive control, confirming real code files are unaffected.

Manual repro (autocomplete leaking into the Copilot Chat input) requires a build of the extension with Copilot installed; the behavior is otherwise fully covered by the unit tests above.

the inline completion provider is registered with a catch-all selector ({ pattern: '**' }) so it was running inside other extensions text inputs, including the copilot chat input. the handler only returned early for the vscode-scm scheme.

this adds a small denylist of non-code input schemes (chat, comment, output, settings) and skips completions there, plus folds in the existing vscode-scm guard. went with a denylist instead of narrowing the selector so it doesnt accidentally break vscode-remote, vscode-vfs, untitled and notebook docs.

Closes continuedev#12933
@minh2416294 minh2416294 requested a review from a team as a code owner July 3, 2026 16:21
@minh2416294 minh2416294 requested review from sestinj and removed request for a team July 3, 2026 16:21
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@minh2416294

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@minh2416294

Copy link
Copy Markdown
Author

quick heads up on the red check, I think it looks unrelated to this change.

the jetbrains-tests failure is the intellij integration test Autocomplete > testAutocomplete() (Autocomplete.kt:42). this PR only touches extensions/vscode/ (the completion provider + its test) so it cant affect the jetbrains plugin build, and that same test is failing on other open PRs right now that dont touch jetbrains either, so it seems pre-existing rather than caused by this change

the vscode checks (vscode-checks, the autocomplete e2e, lint, prettier, the test matrix on all node versions) are all green. happy to dig in if you want but wanted to flag the red doesnt look like its from this PR. thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant