You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@go2sh Well, keep doing what you're doing... But keep an eye out, as your extension might get broken by a future VS Code update... Platform specific extensions is something we have on our radar and we track that at #23251
Here is the code pattern that you can use:
/**
* Returns a node module installed with VSCode, or null if it fails.
*/
function getCoreNodeModule(moduleName: string) {
try {
return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`);
} catch (err) { }
try {
return require(`${vscode.env.appRoot}/node_modules/${moduleName}`);
} catch (err) { }
return null;
}
i.e. please always handle the failure case and inform users...
It would be nice to use the node-pty module shipped with vscode in an extension. Currently, I'am doing the following:
It should be possible to create a require interceptor injecting the parrents
node-pty
object into the extension.This is especially nice as there is no general way of loading platform dependent code.
The text was updated successfully, but these errors were encountered: