Skip to content

[Feat]: Code Completion Support #143

@samyakkkk

Description

@samyakkkk

Is your feature request related to a problem?

An important aspect of an AI copilot is on-the-go code completion. It'd be very helpful for FlutterGPT to have inbuilt support for this.

Describe the solution that you'd like

It'd be great to have a similar experience to Github Copilot where the suggestions are given in real-time and can be accepted with a Tab.

Some important aspects while designing a solution to think over are:

1. What model to use?

Ideally, code-completion models are fine-tuned LLMs for this purpose. Google itself has its series of completion models called code-gecko. However, at the moment, they don't provide dart support.

A workaround for that is to prompt the Gemini models to complete the code for us. This could be better because Gemini is a bigger model and can give better results compared to smaller fine-tuned models.

2. What challenges do we anticipate?

There'd of course be challenges like:

  • Slow speed due to a bigger model.
  • Gemini may misunderstand the instructions to return the full code instead of just the completion.
  • Only prose and no code in a few scenarios.

3. How could we tackle the challenges?

  • Maybe to start with, instead of auto, we can instruct users to trigger the completion manually a key combination like command + >This will make sense because, with a slower speed during the time we fetch the generation, the user may have already proceeded ahead. If they use a manual trigger, we can show our default loading indicator.
  • We should also have a solid verification mechanism to ensure that the code received is the right completion (i.e. it doesn't contain any repeats etc) and retry the request if the checks aren't met.

Describe alternatives that you have considered

No response

Additional Information

Github Copilot Example:

Here is a good reference to a similar open-sourced code completion extension: https://github.com/hieunc229/copilot-clone/blob/master/src/extension.ts

It seems like that we'd by using InlineCompletionProvider API by VSCODE.

Acceptance Criteria

The basic acceptance criteria are receiving valid code completions when manually triggered by the user.

Anything more will be appreciated but please discuss it here before implementing.

In the next ticket, we'd enhance this feature by providing valid contextual code and references in the code completion prompt.

Metadata

Metadata

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions