Skip to content

Commit dc1a16e

Browse files
committed
Revert "Add back context to patch"
This reverts commit b4710a1.
1 parent b4710a1 commit dc1a16e

1 file changed

Lines changed: 24 additions & 147 deletions

File tree

scripts/vscode.patch

Lines changed: 24 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,27 @@ diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/s
22
index 457818a975..ad45ffe58a 100644
33
--- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
44
+++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
5-
@@ -194,3 +194,5 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
6-
main(server, data, configuration);
7-
ipcRenderer.send('handshake:im ready');
8-
}
5+
@@ -196,0 +197,2 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
96
+
107
+startup({ machineId: "1" });
118
diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts
129
index 5e43f1b39e..a008d3ac7e 100644
1310
--- a/src/vs/editor/contrib/clipboard/clipboard.ts
1411
+++ b/src/vs/editor/contrib/clipboard/clipboard.ts
15-
@@ -26,7 +26,8 @@ const supportsCopyWithSyntaxHighlighting = (supportsCopy && !browser.isEdgeOrIE)
16-
// Chrome incorrectly returns true for document.queryCommandSupported('paste')
17-
// when the paste feature is available but the calling script has insufficient
18-
// privileges to actually perform the action
12+
@@ -29 +29,2 @@ const supportsCopyWithSyntaxHighlighting = (supportsCopy && !browser.isEdgeOrIE)
1913
-const supportsPaste = (platform.isNative || (!browser.isChrome && document.queryCommandSupported('paste')));
2014
+// const supportsPaste = (platform.isNative || (!browser.isChrome && document.queryCommandSupported('paste')));
2115
+const supportsPaste = true;
22-
23-
type ExecCommand = 'cut' | 'copy' | 'paste';
24-
25-
@@ -174,11 +175,12 @@ class ExecCommandPasteAction extends ExecCommandAction {
26-
kbOpts = null;
27-
}
28-
16+
@@ -176,0 +178 @@ class ExecCommandPasteAction extends ExecCommandAction {
2917
+ const { client } = require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode');
30-
super('paste', {
31-
id: 'editor.action.clipboardPasteAction',
32-
label: nls.localize('actions.clipboard.pasteLabel', "Paste"),
33-
alias: 'Paste',
18+
@@ -181 +183 @@ class ExecCommandPasteAction extends ExecCommandAction {
3419
- precondition: EditorContextKeys.writable,
3520
+ precondition: (require('vs/platform/contextkey/common/contextkey') as typeof import('vs/platform/contextkey/common/contextkey')).ContextKeyExpr.and(EditorContextKeys.writable, client.clipboardContextKey),
36-
kbOpts: kbOpts,
37-
menuOpts: {
38-
group: CLIPBOARD_CONTEXT_MENU_GROUP,
39-
@@ -188,10 +190,25 @@ class ExecCommandPasteAction extends ExecCommandAction {
40-
menuId: MenuId.MenubarEditMenu,
41-
group: '2_ccp',
42-
title: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, "&&Paste"),
21+
@@ -191 +193,2 @@ class ExecCommandPasteAction extends ExecCommandAction {
4322
- order: 3
4423
+ order: 3,
4524
+ when: client.clipboardContextKey,
46-
}
47-
});
48-
}
25+
@@ -194,0 +198,14 @@ class ExecCommandPasteAction extends ExecCommandAction {
4926
+
5027
+ public async run(accessor, editor: ICodeEditor): Promise<void> {
5128
+ if (editor instanceof (require('vs/editor/browser/widget/codeEditorWidget') as typeof import('vs/editor/browser/widget/codeEditorWidget')).CodeEditorWidget) {
@@ -60,17 +37,11 @@ index 5e43f1b39e..a008d3ac7e 100644
6037
+ super.run(accessor, editor);
6138
+ }
6239
+ }
63-
}
64-
65-
class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction {
6640
diff --git a/src/vs/loader.js b/src/vs/loader.js
6741
index 2bf7fe37d7..81cc668f12 100644
6842
--- a/src/vs/loader.js
6943
+++ b/src/vs/loader.js
70-
@@ -667,10 +667,10 @@ var AMDLoader;
71-
}
72-
this._didInitialize = true;
73-
// capture node modules
44+
@@ -670,4 +670,4 @@ var AMDLoader;
7445
- this._fs = nodeRequire('fs');
7546
- this._vm = nodeRequire('vm');
7647
- this._path = nodeRequire('path');
@@ -79,77 +50,44 @@ index 2bf7fe37d7..81cc668f12 100644
7950
+ this._vm = require('vm');
8051
+ this._path = require('path');
8152
+ this._crypto = require('crypto');
82-
};
83-
// patch require-function of nodejs such that we can manually create a script
84-
// from cached data. this is done by overriding the `Module._compile` function
85-
@@ -731,11 +731,18 @@ var AMDLoader;
86-
this._init(nodeRequire);
87-
this._initNodeRequire(nodeRequire, moduleManager);
88-
var recorder = moduleManager.getRecorder();
53+
@@ -733,0 +734,7 @@ var AMDLoader;
8954
+ const context = require.context("../", true, /.*/);
9055
+ if (scriptSrc.indexOf("file:///") !== -1) {
9156
+ const vsSrc = scriptSrc.split("file:///")[1].split(".js")[0];
9257
+ if (vsSrc && vsSrc.startsWith("vs/")) {
9358
+ scriptSrc = `node|./${vsSrc}`;
9459
+ }
9560
+ }
96-
if (/^node\|/.test(scriptSrc)) {
97-
var pieces = scriptSrc.split('|');
98-
var moduleExports_1 = null;
99-
try {
61+
@@ -738 +745 @@ var AMDLoader;
10062
- moduleExports_1 = nodeRequire(pieces[1]);
10163
+ moduleExports_1 = context(pieces[1]);
102-
}
103-
catch (err) {
104-
errorback(err);
10564
diff --git a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
10665
index e3efb95b75..163bc4c994 100644
10766
--- a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
10867
+++ b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
109-
@@ -55,6 +55,9 @@ export class HeapService implements IHeapService {
110-
111-
private _doTrackRecursive(obj: any): Promise<any> {
112-
68+
@@ -57,0 +58,3 @@ export class HeapService implements IHeapService {
11369
+ // Cannot control GC in the browser.
11470
+ return Promise.resolve(obj);
11571
+
116-
if (isNullOrUndefined(obj)) {
117-
return Promise.resolve(obj);
118-
}
11972
diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts
12073
index 7841dcdaa2..f5665f0db3 100644
12174
--- a/src/vs/workbench/api/node/extHostExtensionService.ts
12275
+++ b/src/vs/workbench/api/node/extHostExtensionService.ts
123-
@@ -651,7 +651,7 @@ function loadCommonJSModule<T>(logService: ILogService, modulePath: string, acti
124-
activationTimesBuilder.codeLoadingStart();
125-
logService.info(`ExtensionService#loadCommonJSModule ${modulePath}`);
126-
try {
76+
@@ -654 +654 @@ function loadCommonJSModule<T>(logService: ILogService, modulePath: string, acti
12777
- r = require.__$__nodeRequire<T>(modulePath);
12878
+ r = (global as any).nativeNodeRequire(modulePath);
129-
} catch (e) {
130-
return Promise.reject(e);
131-
} finally {
13279
diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts
13380
index 38bf337a61..a6ee664a20 100644
13481
--- a/src/vs/workbench/browser/dnd.ts
13582
+++ b/src/vs/workbench/browser/dnd.ts
136-
@@ -168,7 +168,7 @@ export class ResourcesDropHandler {
137-
handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup, afterDrop: (targetGroup: IEditorGroup) => void, targetIndex?: number): void {
138-
const untitledOrFileResources = extractResources(event).filter(r => this.fileService.canHandleResource(r.resource) || r.resource.scheme === Schemas.untitled);
139-
if (!untitledOrFileResources.length) {
83+
@@ -171 +171 @@ export class ResourcesDropHandler {
14084
- return;
14185
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex);
142-
}
143-
144-
// Make the window active to handle the drop properly within
14586
diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts
14687
index a43d63aa51..438d0a8245 100644
14788
--- a/src/vs/workbench/electron-browser/main.ts
14889
+++ b/src/vs/workbench/electron-browser/main.ts
149-
@@ -147,13 +147,13 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
150-
shell.open();
151-
152-
// Inform user about loading issues from the loader
90+
@@ -150,7 +150,7 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
15391
- (<any>self).require.config({
15492
- onError: err => {
15593
- if (err.errorCode === 'load') {
@@ -164,67 +102,37 @@ index a43d63aa51..438d0a8245 100644
164102
+ // }
165103
+ // }
166104
+ // });
167-
});
168-
});
169-
});
170105
diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts
171106
index ea348f3a04..ada0003fea 100644
172107
--- a/src/vs/workbench/electron-browser/window.ts
173108
+++ b/src/vs/workbench/electron-browser/window.ts
174-
@@ -45,7 +45,7 @@ const TextInputActions: IAction[] = [
175-
new Separator(),
176-
new Action('editor.action.clipboardCutAction', nls.localize('cut', "Cut"), null, true, () => document.execCommand('cut') && Promise.resolve(true)),
177-
new Action('editor.action.clipboardCopyAction', nls.localize('copy', "Copy"), null, true, () => document.execCommand('copy') && Promise.resolve(true)),
109+
@@ -48 +48 @@ const TextInputActions: IAction[] = [
178110
- new Action('editor.action.clipboardPasteAction', nls.localize('paste', "Paste"), null, true, () => document.execCommand('paste') && Promise.resolve(true)),
179111
+ (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.pasteAction,
180-
new Separator(),
181-
new Action('editor.action.selectAll', nls.localize('selectAll', "Select All"), null, true, () => document.execCommand('selectAll') && Promise.resolve(true))
182-
];
183112
diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts
184113
index 35bc4a82b3..45e96001b6 100644
185114
--- a/src/vs/workbench/electron-browser/workbench.ts
186115
+++ b/src/vs/workbench/electron-browser/workbench.ts
187-
@@ -248,6 +248,7 @@ export class Workbench extends Disposable implements IPartService {
188-
super();
189-
190-
this.workbenchParams = { configuration, serviceCollection };
116+
@@ -250,0 +251 @@ export class Workbench extends Disposable implements IPartService {
191117
+ (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.serviceCollection = serviceCollection;
192-
193-
this.hasInitialFilesToOpen =
194-
(configuration.filesToCreate && configuration.filesToCreate.length > 0) ||
195118
diff --git a/src/vs/workbench/node/extensionHostProcess.ts b/src/vs/workbench/node/extensionHostProcess.ts
196119
index 8d182d18d9..69d51e1aea 100644
197120
--- a/src/vs/workbench/node/extensionHostProcess.ts
198121
+++ b/src/vs/workbench/node/extensionHostProcess.ts
199-
@@ -129,7 +129,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
200-
// Kill oneself if one's parent dies. Much drama.
201-
setInterval(function () {
202-
try {
122+
@@ -132 +132 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
203123
- process.kill(initData.parentPid, 0); // throws an exception if the main process doesn't exist anymore.
204124
+ // process.kill(initData.parentPid, 0); // throws an exception if the main process doesn't exist anymore.
205-
} catch (e) {
206-
onTerminate();
207-
}
208125
diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
209126
index e600fb2f78..1e0dc9a220 100644
210127
--- a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
211128
+++ b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
212-
@@ -932,6 +932,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
213-
}
214-
215-
private handleExternalDrop(tree: ITree, data: DesktopDragAndDropData, target: ExplorerItem | Model, originalEvent: DragMouseEvent): TPromise<void> {
129+
@@ -934,0 +935 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
216130
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.handleExternalDrop(target, originalEvent);
217-
const droppedResources = extractResources(originalEvent.browserEvent as DragEvent, true);
218-
219-
// Check for dropped external files to be folders
220131
diff --git a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
221132
index 7b4e8721ac..96d612f940 100644
222133
--- a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
223134
+++ b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts
224-
@@ -28,14 +28,16 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW
225-
public provideTextContent(resource: URI): Thenable<ITextModel> {
226-
const query = resource.query ? JSON.parse(resource.query) : {};
227-
const content: Thenable<string | ITextBufferFactory> = (query.moduleId ? new Promise<string>((resolve, reject) => {
135+
@@ -31,6 +31,6 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW
228136
- require([query.moduleId], content => {
229137
- try {
230138
- resolve(content.default());
@@ -237,27 +145,15 @@ index 7b4e8721ac..96d612f940 100644
237145
+ resolve(content.default());
238146
+ }).catch((err) => {
239147
+ reject(err);
240-
});
148+
@@ -38 +38,3 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW
241149
- }) : this.textFileService.resolveTextContent(URI.file(resource.fsPath)).then(content => content.value));
242150
+ }) : (resource.scheme !== "file"
243151
+ ? fetch(resource.path).then((res) => res.text())
244152
+ : this.textFileService.resolveTextContent(URI.file(resource.fsPath)).then(content => content.value)));
245-
return content.then(content => {
246-
let codeEditorModel = this.modelService.getModel(resource);
247-
if (!codeEditorModel) {
248-
@@ -61,7 +63,7 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
249-
}
250-
251-
public provideTextContent(resource: URI): Thenable<ITextModel> {
153+
@@ -64 +66 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
252154
- return this.textFileService.resolveTextContent(URI.file(resource.fsPath)).then(content => {
253155
+ return fetch(resource.path).then((res) => res.text()).then((content) => {
254-
let codeEditorModel = this.modelService.getModel(resource);
255-
if (!codeEditorModel) {
256-
const j = parseInt(resource.fragment);
257-
@@ -78,17 +80,17 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
258-
return '';
259-
};
260-
156+
@@ -81,5 +83,5 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
261157
- const textBuffer = content.value.create(DefaultEndOfLine.LF);
262158
- const lineCount = textBuffer.getLineCount();
263159
- const range = new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1);
@@ -268,38 +164,19 @@ index 7b4e8721ac..96d612f940 100644
268164
+ // const range = new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1);
269165
+ // const markdown = textBuffer.getValueInRange(range, EndOfLinePreference.TextDefined);
270166
+ marked(content, { renderer });
271-
272-
const languageId = this.modeService.getModeIdForLanguageName(languageName);
273-
const languageSelection = this.modeService.create(languageId);
274-
codeEditorModel = this.modelService.createModel(codeSnippet, languageSelection, resource);
275-
} else {
167+
@@ -91 +93 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
276168
- this.modelService.updateModel(codeEditorModel, content.value);
277169
+ this.modelService.updateModel(codeEditorModel, content);
278-
}
279-
280-
return codeEditorModel;
281170
diff --git a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
282171
index 4cb7a231f3..78c87d13f6 100644
283172
--- a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
284173
+++ b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
285-
@@ -31,6 +31,7 @@ interface IExtensionCacheData {
286-
287-
let _SystemExtensionsRoot: string | null = null;
288-
function getSystemExtensionsRoot(): string {
174+
@@ -33,0 +34 @@ function getSystemExtensionsRoot(): string {
289175
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.builtInExtensionsDirectory;
290-
if (!_SystemExtensionsRoot) {
291-
_SystemExtensionsRoot = path.normalize(path.join(getPathFromAmdModule(require, ''), '..', 'extensions'));
292-
}
293176
diff --git a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts
294177
index 5b4136989f..25ccc0fe9e 100644
295178
--- a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts
296179
+++ b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts
297-
@@ -178,7 +178,7 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
298-
299-
const iconThemeDocumentLocationDirname = resources.dirname(iconThemeDocumentLocation);
300-
function resolvePath(path: string) {
180+
@@ -181 +181 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
301181
- return resources.joinPath(iconThemeDocumentLocationDirname, path);
302182
+ return "/resource" + resources.joinPath(iconThemeDocumentLocationDirname, path).path;
303-
}
304-
305-
function collectSelectors(associations: IconsAssociation, baseThemeClassName?: string) {

0 commit comments

Comments
 (0)