Skip to content

fix: pass editor content for JetBrains autocomplete to fix large file truncation#12399

Open
praneethb7 wants to merge 4 commits into
continuedev:mainfrom
praneethb7:fix/jetbrains-autocomplete-large-file
Open

fix: pass editor content for JetBrains autocomplete to fix large file truncation#12399
praneethb7 wants to merge 4 commits into
continuedev:mainfrom
praneethb7:fix/jetbrains-autocomplete-large-file

Conversation

@praneethb7
Copy link
Copy Markdown

@praneethb7 praneethb7 commented May 13, 2026

Description

Fixes #12390 : autocomplete showing wrong/static prefix & suffix on files larger than ~3000 lines in JetBrains.

Root cause: FileUtils.readFile() caps file content at 100,000 characters. For large files this truncates the content always from line 0, so the core computed the same wrong prefix/suffix regardless of cursor position.

Fix: Pass editor.document.text (full live in-memory content, no size limit) as manuallyPassFileContents in the autocomplete request, exactly mirroring what the VS Code extension already does via openTextDocument.getText(). When manuallyPassFileContents is present, the core skips the disk/file read entirely.

Changes:

  • CompletionService.kt : added optional fileContents parameter to interface
  • ContinueCompletionService.kt : passes manuallyPassFileContents in the request payload
  • ContinueInlineCompletionProvider.kt : reads editor.document.text and passes it to the service

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

N/A: The fix mirrors the existing VS Code implementation and was verified by code inspection.

Tests

No new tests added. The fix mirrors the VS Code extension's approach (openTextDocument.getText()).


Summary by cubic

Fixes wrong/static autocomplete prefixes and suffixes in JetBrains for large files by sending the full in-memory editor text instead of reading from disk. Also updates docs to cover local config profiles and dynamic model fetching in the UI.

  • Bug Fixes
    • Pass editor.document.text as manuallyPassFileContents so the core skips disk reads and uses the full file content.
    • Add optional fileContents to CompletionService and wire it through ContinueCompletionService and ContinueInlineCompletionProvider.
    • Update unit test mock to match the new getAutocomplete signature.

Written for commit bccf247. Summary will update on new commits.

@praneethb7 praneethb7 requested a review from a team as a code owner May 13, 2026 09:43
@praneethb7 praneethb7 requested review from sestinj and removed request for a team May 13, 2026 09:43
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 13, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Truncated / wrong prefix & suffix on large file Autocompletion

1 participant