microsoft / vscode

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

URLService: should it handle vscode.env.openExternal / opn() too? #79506

Closed bpasero closed 5 years ago

bpasero commented 5 years ago

We have a URLService that registers an opener with IOpenerService to handle schemas of product.urlProtocol.

I recently added changes so that each vscode.env.openExternal() or the related usage of the opn module from an extension also goes through the opener service.

Today we always send those things to shell.openExternal(), however for the case of a vscode:// URL I wonder if we need to do that? It seems like a unnecessary hop that will start a VSCode instance only to send the data over.

Thus, my question: should the URLService also handle each incoming open call from extensions if the product.urlProtocol is being used? Currently I explicitly opt-out of that by checking for options.openExternal and thus keeping todays behaviour.

joaomoreno commented 5 years ago

Not sure. I think that service is tricking you due to its generic name: URLService. If it was called ProductProtocolHandlerService, the distinction would be more obvious.

I like to think about it as a router for product.urlProtocol URLs within the product... while the OpenerService can handle any URL, including product.urlProtocol URLs in which case it should just forward to the former.

bpasero commented 5 years ago

I pushed the original intent of this issue.