15

I just got github copilot access and i am new to it whenever i give it a comment and press tab and enter it just creates the same comment over and over again but in same cases it workshere is the image is there a way to fix this? or is it just a beta error?

Maybe Lindow
  • 183
  • 1
  • 1
  • 7

2 Answers2

18

Go on new line after comment, and start typing what you want to create. In your case type def and wait a while. If not enough give the function name and wait a while again.

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
Atzuki
  • 627
  • 1
  • 5
  • 16
  • If this works, please accept the answer, else tell us whats wrong –  Feb 05 '22 at 06:50
  • That isn't generating code off of the comment like their asking. I found as of today that my comments generate code like normal in VS Code, but in Jetbrains GoLand I have the same issue as @Maybe Lindow. If I recall when I was in preview this worked fine in GoLand and noticed today it doesn't. I may be recalling incorrectly though. – Kuberchaun Jun 29 '22 at 21:36
  • Ok I played around a bit it seems atleast in go in GoLand if I do this comment style /* Create a function that adds two numbers together and returns the result. */ and hit return it works. If I do a comment like // Create a function that adds two numbers together and returns the result I get the same result as @Maybe Lindow. – Kuberchaun Jun 29 '22 at 21:41
3

First Add single line comment in you visual studio code that describe code you want to be written by github copilot like // function to add two numbers in javascript then press Enter wait for little seconds code that do what you described in comment will appear then press tab. Note : in some case your code might be incomplete just keep pressing enter then tab when code look like comment.

twizelissa
  • 111
  • 5
  • Sometimes copilot will just repeat your comment - when this happens, see the accepted answer. – mac Jul 20 '23 at 13:04