code-server-2/scripts/vscode.patch

176 lines
11 KiB
Diff
Raw Normal View History

2019-01-19 00:04:24 +00:00
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
2019-02-06 19:00:24 +00:00
@@ -196,0 +197,2 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
2019-01-19 00:04:24 +00:00
+
+startup({ machineId: "1" });
diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts
2019-02-06 18:59:03 +00:00
index 5e43f1b39e..a008d3ac7e 100644
--- a/src/vs/editor/contrib/clipboard/clipboard.ts
+++ b/src/vs/editor/contrib/clipboard/clipboard.ts
2019-02-06 19:00:24 +00:00
@@ -29 +29,2 @@ const supportsCopyWithSyntaxHighlighting = (supportsCopy && !browser.isEdgeOrIE)
-const supportsPaste = (platform.isNative || (!browser.isChrome && document.queryCommandSupported('paste')));
+// const supportsPaste = (platform.isNative || (!browser.isChrome && document.queryCommandSupported('paste')));
+const supportsPaste = true;
2019-02-06 19:00:24 +00:00
@@ -176,0 +178 @@ class ExecCommandPasteAction extends ExecCommandAction {
2019-02-06 18:59:03 +00:00
+ const { client } = require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode');
2019-02-06 19:00:24 +00:00
@@ -181 +183 @@ class ExecCommandPasteAction extends ExecCommandAction {
- precondition: EditorContextKeys.writable,
2019-02-06 18:59:03 +00:00
+ precondition: (require('vs/platform/contextkey/common/contextkey') as typeof import('vs/platform/contextkey/common/contextkey')).ContextKeyExpr.and(EditorContextKeys.writable, client.clipboardContextKey),
2019-02-06 19:00:24 +00:00
@@ -191 +193,2 @@ class ExecCommandPasteAction extends ExecCommandAction {
- order: 3
+ order: 3,
+ when: client.clipboardContextKey,
2019-02-06 19:00:24 +00:00
@@ -194,0 +198,14 @@ class ExecCommandPasteAction extends ExecCommandAction {
+
+ public async run(accessor, editor: ICodeEditor): Promise<void> {
2019-02-06 18:59:03 +00:00
+ if (editor instanceof (require('vs/editor/browser/widget/codeEditorWidget') as typeof import('vs/editor/browser/widget/codeEditorWidget')).CodeEditorWidget) {
+ try {
2019-02-06 18:59:03 +00:00
+ editor.trigger('', (require('vs/editor/common/editorCommon') as typeof import ('vs/editor/common/editorCommon')).Handler.Paste, {
+ text: await (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.clipboardText,
+ });
+ } catch (ex) {
+ super.run(accessor, editor);
+ }
+ } else {
+ super.run(accessor, editor);
+ }
+ }
2019-01-19 00:04:24 +00:00
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
2019-02-06 19:00:24 +00:00
@@ -670,4 +670,4 @@ var AMDLoader;
2019-01-19 00:04:24 +00:00
- 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');
2019-02-06 19:00:24 +00:00
@@ -733,0 +734,7 @@ var AMDLoader;
2019-01-19 00:04:24 +00:00
+ 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}`;
+ }
+ }
2019-02-06 19:00:24 +00:00
@@ -738 +745 @@ var AMDLoader;
2019-01-19 00:04:24 +00:00
- moduleExports_1 = nodeRequire(pieces[1]);
+ moduleExports_1 = context(pieces[1]);
2019-01-31 22:19:12 +00:00
diff --git a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
2019-02-02 01:55:32 +00:00
index e3efb95b75..163bc4c994 100644
2019-01-31 22:19:12 +00:00
--- a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
+++ b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
2019-02-06 19:00:24 +00:00
@@ -57,0 +58,3 @@ export class HeapService implements IHeapService {
2019-02-02 01:55:32 +00:00
+ // Cannot control GC in the browser.
2019-01-31 22:19:12 +00:00
+ return Promise.resolve(obj);
+
2019-01-30 21:40:01 +00:00
diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts
2019-02-06 18:59:03 +00:00
index 38bf337a61..a6ee664a20 100644
2019-01-30 21:40:01 +00:00
--- a/src/vs/workbench/browser/dnd.ts
+++ b/src/vs/workbench/browser/dnd.ts
2019-02-06 19:00:24 +00:00
@@ -171 +171 @@ export class ResourcesDropHandler {
2019-01-30 21:40:01 +00:00
- return;
2019-02-06 18:59:03 +00:00
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex);
2019-01-19 00:04:24 +00:00
diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts
2019-02-02 01:55:32 +00:00
index a43d63aa51..438d0a8245 100644
2019-01-19 00:04:24 +00:00
--- a/src/vs/workbench/electron-browser/main.ts
+++ b/src/vs/workbench/electron-browser/main.ts
2019-02-06 19:00:24 +00:00
@@ -150,7 +150,7 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
2019-01-19 00:04:24 +00:00
- (<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))));
- }
- }
- });
+ // (<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))));
+ // }
+ // }
+ // });
diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts
2019-02-06 18:59:03 +00:00
index ea348f3a04..ada0003fea 100644
--- a/src/vs/workbench/electron-browser/window.ts
+++ b/src/vs/workbench/electron-browser/window.ts
2019-02-06 19:00:24 +00:00
@@ -48 +48 @@ const TextInputActions: IAction[] = [
- new Action('editor.action.clipboardPasteAction', nls.localize('paste', "Paste"), null, true, () => document.execCommand('paste') && Promise.resolve(true)),
2019-02-06 18:59:03 +00:00
+ (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.pasteAction,
2019-01-30 21:40:01 +00:00
diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts
2019-02-06 18:59:03 +00:00
index 35bc4a82b3..45e96001b6 100644
2019-01-30 21:40:01 +00:00
--- a/src/vs/workbench/electron-browser/workbench.ts
+++ b/src/vs/workbench/electron-browser/workbench.ts
2019-02-06 19:00:24 +00:00
@@ -250,0 +251 @@ export class Workbench extends Disposable implements IPartService {
2019-02-06 18:59:03 +00:00
+ (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.serviceCollection = serviceCollection;
2019-01-25 20:36:47 +00:00
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
2019-02-06 19:00:24 +00:00
@@ -132 +132 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
2019-01-25 20:36:47 +00:00
- 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.
2019-01-30 21:40:01 +00:00
diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
2019-02-06 18:59:03 +00:00
index e600fb2f78..1e0dc9a220 100644
2019-01-30 21:40:01 +00:00
--- a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
+++ b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
2019-02-06 19:00:24 +00:00
@@ -934,0 +935 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
2019-02-06 18:59:03 +00:00
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.handleExternalDrop(target, originalEvent);
diff --git a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
2019-02-02 01:55:32 +00:00
index 7b4e8721ac..96d612f940 100644
--- a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
+++ b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
2019-02-06 19:00:24 +00:00
@@ -31,6 +31,6 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW
- require([query.moduleId], content => {
2019-02-02 01:55:32 +00:00
- try {
- resolve(content.default());
- } catch (err) {
- reject(err);
- }
+ // This works because the only walkthrough that is a module is the welcome page.
+ // We have to explicitly import it or Webpack won't pick it up.
+ import("vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page").then((content) => {
2019-02-02 01:55:32 +00:00
+ resolve(content.default());
+ }).catch((err) => {
+ reject(err);
2019-02-06 19:00:24 +00:00
@@ -38 +38,3 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW
2019-02-02 01:55:32 +00:00
- }) : this.textFileService.resolveTextContent(URI.file(resource.fsPath)).then(content => content.value));
+ }) : (resource.scheme !== "file"
+ ? fetch(resource.path).then((res) => res.text())
+ : this.textFileService.resolveTextContent(URI.file(resource.fsPath)).then(content => content.value)));
2019-02-06 19:00:24 +00:00
@@ -64 +66 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
2019-02-02 01:55:32 +00:00
- return this.textFileService.resolveTextContent(URI.file(resource.fsPath)).then(content => {
+ return fetch(resource.path).then((res) => res.text()).then((content) => {
2019-02-06 19:00:24 +00:00
@@ -81,5 +83,5 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
2019-02-02 01:55:32 +00:00
- const textBuffer = content.value.create(DefaultEndOfLine.LF);
- const lineCount = textBuffer.getLineCount();
- const range = new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1);
- const markdown = textBuffer.getValueInRange(range, EndOfLinePreference.TextDefined);
- marked(markdown, { renderer });
+ // const textBuffer = content.value.create(DefaultEndOfLine.LF);
+ // const lineCount = textBuffer.getLineCount();
+ // const range = new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1);
+ // const markdown = textBuffer.getValueInRange(range, EndOfLinePreference.TextDefined);
+ marked(content, { renderer });
2019-02-06 19:00:24 +00:00
@@ -91 +93 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
2019-02-02 01:55:32 +00:00
- this.modelService.updateModel(codeEditorModel, content.value);
+ this.modelService.updateModel(codeEditorModel, content);
2019-02-06 17:01:15 +00:00
diff --git a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
2019-02-06 18:59:03 +00:00
index 4cb7a231f3..78c87d13f6 100644
2019-02-06 17:01:15 +00:00
--- a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
+++ b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
2019-02-06 19:00:24 +00:00
@@ -33,0 +34 @@ function getSystemExtensionsRoot(): string {
2019-02-06 18:59:03 +00:00
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.builtInExtensionsDirectory;
2019-01-30 21:40:01 +00:00
diff --git a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts
index 5b4136989f..25ccc0fe9e 100644
--- a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts
+++ b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts
2019-02-06 19:00:24 +00:00
@@ -181 +181 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
2019-01-30 21:40:01 +00:00
- return resources.joinPath(iconThemeDocumentLocationDirname, path);
+ return "/resource" + resources.joinPath(iconThemeDocumentLocationDirname, path).path;