devchat-ai / devchat

Automate your dev tasks with AI-powered scripts, from your IDE's chat panel.
https://www.devchat.ai
Apache License 2.0
340 stars 39 forks source link

Optimize code completion hint range detection #322

Closed yangbobo2021 closed 4 months ago

yangbobo2021 commented 4 months ago

There is an issue with how the code completion hint range is determined. If the completion range is set incorrectly, the completion suggestions won't be displayed. For example, consider the case a= | + 2; where | represents the cursor position. In this scenario, the completion should suggest a, but if the code completion range is set to an incorrect range, the IDE fails to display the completion suggestion for a. This issue impacts the user experience by not providing relevant suggestions when expected.

Steps to reproduce:

  1. Navigate to a code line a= | + 2;.
  2. Attempt to trigger code completion at the cursor position.

Expected behavior:

Actual behavior: