Skip to content

Conversation

@markijbema
Copy link
Contributor

Summary

This PR adds context-aware single-line truncation to the autocomplete functionality to improve acceptance rates.

Changes

  • uselessSuggestionFilter.ts: Added multiline parameter to postprocessGhostSuggestion. When multiline=false, completions are truncated at the first newline character.

  • types.ts: Added multiline: boolean field to FimGhostPrompt and HoleFillerGhostPrompt interfaces.

  • FillInTheMiddle.ts: Integrated shouldCompleteMultiline from continuedev to determine when to use single-line mode based on context (cursor position, language, etc.).

  • HoleFiller.ts: Same integration for the hole-filler strategy.

  • GhostInlineCompletionProvider.ts: Pass the multiline flag through to postprocessing.

How it works

The shouldCompleteMultiline function from continuedev determines whether to allow multi-line completions based on:

  • Single-line comments (always single-line)
  • Intellisense selection (always single-line)
  • Language-specific rules
  • Cursor position context

When single-line mode is active, completions are truncated at the first newline, resulting in shorter, more focused suggestions that typically have higher acceptance rates.

Testing

Added comprehensive tests for the new single-line truncation behavior in uselessSuggestionFilter.test.ts.

…e rate

- Add multiline parameter to postprocessGhostSuggestion to control single-line vs multi-line completions
- Integrate shouldCompleteMultiline from continuedev to determine when to use single-line mode
- Update FimPromptBuilder and HoleFiller to include multiline flag in prompts
- Pass multiline flag through GhostInlineCompletionProvider to postprocessing
- Add comprehensive tests for single-line truncation behavior

When multiline=false, completions are truncated at the first newline character,
which typically results in higher acceptance rates for inline completions.
@changeset-bot
Copy link

changeset-bot bot commented Dec 9, 2025

⚠️ No Changeset found

Latest commit: 66c77e1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Add rate limiter configuration (Map, RATE_LIMIT, WINDOW_MS) and clientIP
variable to provide better context for autocomplete. Move autocomplete
marker to new line after TODO comment to encourage actual implementation
rather than more TODO comments.

Remove rejected approval files as they are no longer valid for the
updated test case.
Add cache Map and cacheTTL in constructor to provide context for caching
implementation. Move autocomplete marker inside fetchData method to
encourage actual cache lookup implementation rather than more TODO
comments.

Remove rejected approval files as they are no longer valid for the
updated test case.
Add clear purpose (sum calculation) with total variable and comment to
guide the completion. Place autocomplete marker after 'total' to
encourage += num completion. Add end block and puts statement to
constrain the expected output.

Remove rejected approval files as they are no longer valid for the
updated test case.
Wrap method in Calculator class with end statement and add sibling
calculate_product method to provide pattern context. This constrains
the completion to just the method body rather than generating a whole
program.

Remove rejected approval files as they are no longer valid for the
updated test case.
Add sibling functions (multiply, divide) and module.exports to provide
pattern context and constrain the completion. This prevents the LLM from
generating additional functions after completing the add function.

Remove all approval files (both approved and rejected) as they are no
longer valid for the updated test case.
Consolidate multi-file test into single file with class definition
directly visible above the autocomplete point. Add userId variable to
provide context for findById call. This ensures the LLM has direct
access to the actual method names (findById, findByEmail, updateUser).

Remove rejected approval files as they are no longer valid for the
updated test case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants