microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 282 forks source link

Proxy support for npx gulp vsDebugServer #1955

Open relief-melone opened 9 months ago

relief-melone commented 9 months ago

vscode-js-debug is being used in e.g. nvim. To make use of debugging it's dap plugin needs to build a vscode-js-debug instance. This works fine usually running

npx gulp vsDebugServerBundle

However it woll not work behind corporate proxies because in the gulp task l10n:bundle-download got is being used to fetch the vscode-loc repo. got does not nativly support proxy variables like https_proxy. Suggestion would be to add support with something like this (

const HttpsProxyAgent = require("hpagent").HttpsProxyAgent;
//...
gulp.task('l10n:bundle-download', async () => {
  const opts = {};
  const proxy = process.env.https_proxy || process.env.HTTPS_PROXY || null;
  if (proxy)
    opts.agent = {
      https: new HttpsProxyAgent({
        keepAlive: true,
    keepAliveMsecs: 1000,
    maxSockets: 256,
    maxFreeSockets: 256,
    scheduling: 'lifo',
    proxy
      })
    };

  const res = await got('https://github.com/microsoft/vscode-loc/archive/main.zip', opts).buffer();

  //...

if this finds acceptance I'd gladly submit a PR

connor4312 commented 9 months ago

Sure, I would take a PR, https-proxy-agent is the module we normally use

Also note that we have been publishing a standard DAP server to our GH releases for a while. nvim-dap may want to move over to that...

relief-melone commented 9 months ago

Alright. Will check that module out as well and create that pr. Forked it for now and can confirm that it does build behind the proxy now

relief-melone commented 8 months ago

https://github.com/microsoft/vscode-js-debug/pull/1965

Took a little longer due to vacation