vscode.patch 5.0 KB
Newer Older
A
Asher 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
index 457818a975..ad45ffe58a 100644
--- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
+++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
@@ -194,3 +194,5 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
 	main(server, data, configuration);
 	ipcRenderer.send('handshake:im ready');
 }
+
+startup({ machineId: "1" });
diff --git a/src/vs/loader.js b/src/vs/loader.js
index 2bf7fe37d7..81cc668f12 100644
--- a/src/vs/loader.js
+++ b/src/vs/loader.js
@@ -667,10 +667,10 @@ var AMDLoader;
             }
             this._didInitialize = true;
             // capture node modules
-            this._fs = nodeRequire('fs');
-            this._vm = nodeRequire('vm');
-            this._path = nodeRequire('path');
-            this._crypto = nodeRequire('crypto');
+            this._fs = require('fs');
+            this._vm = require('vm');
+            this._path = require('path');
+            this._crypto = require('crypto');
         };
         // patch require-function of nodejs such that we can manually create a script
         // from cached data. this is done by overriding the `Module._compile` function
@@ -731,11 +731,18 @@ var AMDLoader;
             this._init(nodeRequire);
             this._initNodeRequire(nodeRequire, moduleManager);
             var recorder = moduleManager.getRecorder();
+            const context = require.context("../", true, /.*/);
+            if (scriptSrc.indexOf("file:///") !== -1) {
+                const vsSrc = scriptSrc.split("file:///")[1].split(".js")[0];
+                if (vsSrc && vsSrc.startsWith("vs/")) {
+                  scriptSrc = `node|./${vsSrc}`;
+                }
+            }
             if (/^node\|/.test(scriptSrc)) {
                 var pieces = scriptSrc.split('|');
                 var moduleExports_1 = null;
                 try {
-                    moduleExports_1 = nodeRequire(pieces[1]);
+                    moduleExports_1 = context(pieces[1]);
                 }
                 catch (err) {
                     errorback(err);
diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts
index a43d63aa51..4c6df2fcd9 100644
--- a/src/vs/workbench/electron-browser/main.ts
+++ b/src/vs/workbench/electron-browser/main.ts
@@ -147,13 +147,14 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
 				shell.open();
A
Asher 已提交
56
 
A
Asher 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
 				// Inform user about loading issues from the loader
-				(<any>self).require.config({
-					onError: err => {
-						if (err.errorCode === 'load') {
-							shell.onUnexpectedError(new Error(nls.localize('loaderErrorNative', "Failed to load a required file. Please restart the application to try again. Details: {0}", JSON.stringify(err))));
-						}
-					}
-				});
+				// TODO: how to make this work
+				// (<any>self).require.config({
+				// 	onError: err => {
+				// 		if (err.errorCode === 'load') {
+				// 			shell.onUnexpectedError(new Error(nls.localize('loaderErrorNative', "Failed to load a required file. Please restart the application to try again. Details: {0}", JSON.stringify(err))));
+				// 		}
+				// 	}
+				// });
 			});
 		});
 	});
A
Asher 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88
diff --git a/src/vs/workbench/node/extensionHostProcess.ts b/src/vs/workbench/node/extensionHostProcess.ts
index 8d182d18d9..69d51e1aea 100644
--- a/src/vs/workbench/node/extensionHostProcess.ts
+++ b/src/vs/workbench/node/extensionHostProcess.ts
@@ -129,7 +129,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
 			// Kill oneself if one's parent dies. Much drama.
 			setInterval(function () {
 				try {
-					process.kill(initData.parentPid, 0); // throws an exception if the main process doesn't exist anymore.
+					// process.kill(initData.parentPid, 0); // throws an exception if the main process doesn't exist anymore.
 				} catch (e) {
 					onTerminate();
 				}
K
Kyle Carberry 已提交
89
diff --git a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
A
Asher 已提交
90
index 7b4e8721ac..8f26dc2f28 100644
K
Kyle Carberry 已提交
91 92
--- a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
+++ b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
A
Asher 已提交
93 94
@@ -28,7 +28,9 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW
 	public provideTextContent(resource: URI): Thenable<ITextModel> {
K
Kyle Carberry 已提交
95
 		const query = resource.query ? JSON.parse(resource.query) : {};
A
Asher 已提交
96
 		const content: Thenable<string | ITextBufferFactory> = (query.moduleId ? new Promise<string>((resolve, reject) => {
K
Kyle Carberry 已提交
97
-			require([query.moduleId], content => {
A
Asher 已提交
98
+			// Webpack needs this to be static or it can't include it.
K
Kyle Carberry 已提交
99 100
+			import("vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page").then((content) => {
+			// require([query.moduleId], content => {
A
Asher 已提交
101 102 103
 				try {
 					resolve(content.default());
 				} catch (err) {