continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
19.43k stars 1.69k forks source link

fix: deduplication bug in autocomplete #3001

Closed dhlidongming closed 1 day ago

dhlidongming commented 2 days ago

Description

This PR addresses a bug in the autocomplete service where suggestions were not properly deduplicated when the cursor was positioned in the middle of a line. The issue arose because textAfterCursor could include newline characters, leading to a mismatch when the completion was only one line: https://github.com/continuedev/continue/blob/a9845386f054179651bd1e71e768175a3b873c2e/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt#L126-L132 By detecting and truncating textAfterCursor at the first newline, we ensure that the deduplication process correctly recognizes already existing text after the cursor.

Checklist

Screenshots

Before: image After: image

Testing

[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change. ] [ For new UI features, ensure that the changes look good across viewport widths, light/dark theme, etc ]

netlify[bot] commented 2 days ago

Deploy Preview for continuedev failed. Why did it fail? →

Name Link
Latest commit 0dafb5240f10daa510f7a0ebf8cdda2e1e950c5b
Latest deploy log https://app.netlify.com/sites/continuedev/deploys/673d82f03be33000080e3462