vscodium-and-copilot

· ranguna's blog


Quick Links:

The issue #

If you've installed github copilot in vscodium, you've probably noticed that it just doesn't work.

You'll see some errors related with authentication or vscode versions and all that crazy stuff.

Well, fret not, here's how to get it working.

The fixes (hopefully) #

Small warning: this has worked for me but it's just a workaround and might break at any time. I'll try to update this post whenever possible. Hopefully the copilot team will have some time in the future to implement a permanent fix.

Fixing the authentication issue #

After installing copilot, you'll see a popup asking to login to github, but the login won't work and will instead ask you for an auth token. Here's how you can get it:

  1. Install vscode (yeah I know this sucks, but it's the only way I was able to get the auth token);
  2. In vscode, install copilot;
  3. Before actually logging in, we need to modify the copilot's extension code to yank the auth token:
    1. Open the copilot's extension code in ~/.vscode/extensions/github.copilot-{whatever version you have}/dist/extension.js
    2. Find the line that looks like {headers:{Authorization:`token ${t}`}}); and add the following log right after the semicolon console.log(t);;
    3. Save the file.
  4. Reload vscode and login to github through copilot's prompt.
  5. Check vscode's logs (help > developer tools > console);
  6. Voila! You got your token!
  7. Now you can use this token to login in vscodium;
  8. Alas, you'll now get an errors saying that vscode is not up to date.

Fixing vscode "version" issue #

Copilot will complain that your vscode installation is not up to date, but it's actually as up to date as it can be (if not, make sure your vscodium is at least in the same version as vscode installed before).

It seems copilot is just saying this because it doesn't have access to the proposed features it needs. Here's how to fix it:

  1. In vscodium, when the version error appears, open the console (help > developer tools > console) and look for a message saying Extension 'github.copilot' appears in product.json but enables LESS API proposals than the extension wants.;
  2. That message has additional info about the APIs it's missing (LOSES) and the APIs vscodium is offering (WINS), copy the WINS and the LOSES APIs listed in the message and paste them in the product.json file under the extensionEnabledApiProposals prop like so (replace the list bellow with the copied APIs):
"GitHub.copilot": ["inlineCompletions", "textDocumentNotebook", "inlineCompletionsAdditions"]
  1. Reload vscodium and copilot will now work!

Future copilot updates #

When updating copilot, there's a chance your installation will break again, saying that vscode is not up to date. To fix this, I just followed the steps in this section to get it working again.

Fingers crossed hoping the copilot team fixes this permanently 🤞

Props #

All props for the workaround goes to a github user that listed the above steps on a github discussion, unfortunately I do not remember their name anymore and the original comment has been deleted. If you are the original poster, apologies for not properly tagging you.