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.25k stars 1.66k forks source link

Inject the repository map and custom prefix in autocompletion prompt #2740

Open DanielusG opened 2 weeks ago

DanielusG commented 2 weeks ago

Validations

Problem

As also mentioned in issue #2712 , automatic model completions are “blind” because they do not know enough about the context, so they try to predict parameters or predict queries without knowing the actual structure of the database/codebase

Solution

In the configuration, add a flag to choose whether or not to inject the repository map into the auto-complete prompt and possibly configure which paths to include in the repository map to avoid adding unnecessary code.

I would also propose to introduce the possibility of adding a prefix for each completion prompt.

Currently I already do this (manually) and it works really well, my use case is to add the entire database DDL as a prefix for each file in my backend, and the suggested queries are extremely accurate! (i'm using Qwen 2.7 7B for completions and with this feature is better than Copilot!)

Note:

To inject it into the prompt simply add it as commented code. Maybe by detecting the programming language and adjusting the comment in accordance with the language and adding it to the beginning of the prompt


I would love to help implement these features, only I don't know Javascript and I don't know how to create an extension for VS Code at all, so understanding the codebase and figuring out where to get my hands on it is very complex for me, however suggestions and help are appreciated (maybe using discord)