GITHUB Copilot // Accept line by line

Viewed 635

I'm using GitHub—Copilot in a VS-Code environment. Given the autocompletion feature, I want to have the possibility to only accept line by line.

For example: The autocomplete shows five lines on TAB, but I just need the first two of them.

Is there a config file or any other possibility to achieve this?

1 Answers

Method 1 (Config):

  1. Go to Co-pilot extension settings.

  2. Edit advanced settings

  3. paste this in the settings.json file

  4. You must adjust based on the number of tokens. Try it out a few times to see what works best for you

    "github.copilot.advanced": {
    "length": 500
    }

Method 2 (With Intuition):

This is something I found annoying at times. Upon using it for months, I found that if you want only a line but it is showing you 5-6 lines of autocomplete, you just type something in the current line and it should only autosuggest the line you are on.

for eg, let's say you are trying to make a function that counts prime numbers. Usually, when you comment on this, it should show you the whole function when you name your function or sometimes even hit enter right after the comment.

But instead, you simply name a variable called prim and it should autocomplete the rest based on its approach. It could be primes = 0 and keep on hitting enter, you should see line-by-line.

Related