continuedev / contribution-ideas

A Repo to which to Attach Contribution Ideas
2 stars 0 forks source link

"Use This Snippet" Button #14

Open sestinj opened 1 year ago

sestinj commented 1 year ago

It would be great if you could click a button in the top right of any code block from Continue's output and have it automatically inserted into your code.

If you're interested in making this contribution, don't worry about the button - we can help with that. The real task is to come up with a good prompt that reliably converts (contents of file in question, code block snippet generated by Continue) --> new contents of file.

To do this, you should implement a new subclass of Step and write the run method, where you'll have access to the ContinueSDK, including all of the utilities you need to interact with the IDE, Language Server Protocol, and more. There are many examples of steps in the plugins/steps directory, but the important part is the prompting, so there's probably no need to even clone the Continue repository for the first part of working on this - might be easier to try things in the OpenAI playground.

sestinj commented 8 months ago

Edit: This is now implemented in VS Code by clicking the "Apply to current file" button on any code snippet. But I still think that the prompting could be improved. Most likely this is a more specific task than just "rewrite the code with given instructions". There are likely to be cases where the entire file is being replaced, or a single function is just being replaced, or there is a single insertion somewhere. In these cases, getting the LLM to call a function may be significantly faster than rewriting the entire file.