Copilot for Anvil

I’ve been playing with GitHub copilot for some time and it really struck me.

When I use it in PyCharm, I really think how much I’d like to have it in the Anvil web IDE.

So I thought that while the Anvil team takes their time cooking up this super-cool feature “the Anvil way” (=the way it’s meant to be), I could try to wrap up some stub of a Chrome extension to show the concept, and release to the “expert” programmers.

So, full of courage and with the help of Copilot, I wrapped up this Chrome extension:

DISCLAIMERs:
It’s a concept stub. The code is absolutely not optimized and has no bells&whistles.
It uses ChatGPT 3.5 and not GitHub Copilot. I found very easy to make the 1 REST call to ChatGPT.
You need to insert your OpenAI API key to use it.

I share it here, in the hope that some expert in 1) chrome extensions 2) javascript 3) Anvil internal javascript mechanisms, will take the flag and build on that something more functional. :sweat_smile: :innocent:

It’s really “baremetal”… for example:

  1. there are no “ghost” suggestions. The suggestion is inserted. Fullstop.
  2. inserted suggestions lose the indentation. Because the whole line is replaced and I don’t know how to keep the current indentation.
  3. there is no elegant way to reject a suggestion and ask another one. You need to delete the suggestion and place a new question mark

Ok, enough talking.

Here’s what happens:
ezgif-4-e8dad8bbd5

Take it and make whatever you like with it, or ignore it. :smiley:

Have fun, BR

8 Likes