microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.96k stars 28.47k forks source link

Use `electron.net` in the `github-authentication` extension #207867

Open devm33 opened 5 months ago

devm33 commented 5 months ago

With https://github.com/microsoft/vscode/issues/192899 and https://github.com/microsoft/vscode/pull/206822 extensions have the ability to use electron.net.fetch to benefit from improved proxy and networking capabilities offered by Electron and Chromium.

For github-authentication, this could replace the use of node-fetch.

TylerLeonhardt commented 5 months ago

@deepak1556 @alexdima @chrmarti do either of you know what work is involved for me to adopt this?

deepak1556 commented 5 months ago

Fetch API in Node.js and Electron share the same API design, so you should be able to just swap in the imports and everything should just work. The minimal changes needed would be

import net from 'electron';

export const fetching = net.fetch;

However, I would recommend to try this out as experiment similar to how copilot extension does it, refs https://github.com/microsoft/vscode-copilot/pull/3461