Skip to content

Commit bb46e80

Browse files
committed
Fix extensions that try to load from node_modules.asar
Should allow manual installation of bracket pair colorizer 2: #544.
1 parent 1bd5eca commit bb46e80

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

scripts/vscode.patch

+17-2
Original file line numberDiff line numberDiff line change
@@ -1032,15 +1032,30 @@ index 7c3b6ae53e..18dec6effa 100644
10321032

10331033
get webviewResourceRoot(): string {
10341034
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
1035-
index 6d31b177ac..d7c1705c57 100644
1035+
index 6d31b177ac..67c955a59d 100644
10361036
--- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
10371037
+++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
1038+
@@ -41,12 +41,12 @@ const args = minimist(process.argv.slice(2), {
1039+
const Module = require.__$__nodeRequire('module') as any;
1040+
const originalLoad = Module._load;
1041+
1042+
- Module._load = function (request: string) {
1043+
+ Module._load = function (request: string, parent: object, isMain: boolean) {
1044+
if (request === 'natives') {
1045+
throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more');
1046+
}
1047+
1048+
- return originalLoad.apply(this, arguments);
1049+
+ return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]);
1050+
};
1051+
})();
1052+
10381053
@@ -128,7 +128,7 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
10391054
} else {
10401055
// Do not wait for web companion to reconnect
10411056
protocol.onSocketClose(() => {
10421057
- onTerminate();
1043-
+ process.send!('VSCODE_EXTHOST_DISCONNECTED'); // onTerminate();
1058+
+ process.send!({ type: 'VSCODE_EXTHOST_DISCONNECTED' });
10441059
});
10451060
}
10461061
}

0 commit comments

Comments
 (0)