diff --git a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts index a6256deeba..69819e0f3a 100644 --- a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +++ b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts @@ -311,7 +311,7 @@ export abstract class AbstractScrollableElement extends Widget { this._onMouseWheel(new StandardWheelEvent(browserEvent)); }; - this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, 'mousewheel', onMouseWheel)); + this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, 'wheel', onMouseWheel)); } } 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 { + if (editor instanceof CodeEditorWidget) { + try { + editor.trigger('', Handler.Paste, { + text: await client.clipboardText, + }); + } catch (ex) { + super.run(accessor, editor); + } + } else { + super.run(accessor, editor); + } + } } class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction { 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/api/electron-browser/mainThreadHeapService.ts b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts index e3efb95b75..03e85113a0 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts @@ -55,6 +55,9 @@ export class HeapService implements IHeapService { private _doTrackRecursive(obj: any): Promise { + // cannot control GC in the browser. + return Promise.resolve(obj); + if (isNullOrUndefined(obj)) { return Promise.resolve(obj); } diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index 38bf337a61..aae3a68ff5 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -31,6 +31,7 @@ import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/co import { Disposable } from 'vs/base/common/lifecycle'; import { addDisposableListener, EventType } from 'vs/base/browser/dom'; import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService'; +import { client } from "../../../../../../packages/vscode"; export interface IDraggedResource { resource: URI; @@ -168,7 +169,7 @@ export class ResourcesDropHandler { handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup, afterDrop: (targetGroup: IEditorGroup) => void, targetIndex?: number): void { const untitledOrFileResources = extractResources(event).filter(r => this.fileService.canHandleResource(r.resource) || r.resource.scheme === Schemas.untitled); if (!untitledOrFileResources.length) { - return; + return client.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex); } // Make the window active to handle the drop properly within 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 { shell.open(); // Inform user about loading issues from the loader - (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 + // (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 index ea348f3a04..7c943a71c2 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -38,6 +38,7 @@ import { AccessibilitySupport, isRootUser, isWindows, isMacintosh } from 'vs/bas import product from 'vs/platform/node/product'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor'; +import { client } from "../../../../../../packages/vscode"; const TextInputActions: IAction[] = [ new Action('undo', nls.localize('undo', "Undo"), null, true, () => document.execCommand('undo') && Promise.resolve(true)), @@ -45,7 +46,7 @@ const TextInputActions: IAction[] = [ new Separator(), new Action('editor.action.clipboardCutAction', nls.localize('cut', "Cut"), null, true, () => document.execCommand('cut') && Promise.resolve(true)), new Action('editor.action.clipboardCopyAction', nls.localize('copy', "Copy"), null, true, () => document.execCommand('copy') && Promise.resolve(true)), - new Action('editor.action.clipboardPasteAction', nls.localize('paste', "Paste"), null, true, () => document.execCommand('paste') && Promise.resolve(true)), + client.pasteAction, new Separator(), new Action('editor.action.selectAll', nls.localize('selectAll', "Select All"), null, true, () => document.execCommand('selectAll') && Promise.resolve(true)) ]; diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 35bc4a82b3..9cc84bdf28 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -114,6 +114,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { FileDialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogService'; import { LogStorageAction } from 'vs/platform/storage/node/storageService'; +import { client } from "../../../../../../packages/vscode"; interface WorkbenchParams { configuration: IWindowConfiguration; @@ -248,6 +249,7 @@ export class Workbench extends Disposable implements IPartService { super(); this.workbenchParams = { configuration, serviceCollection }; + client.serviceCollection = serviceCollection; this.hasInitialFilesToOpen = (configuration.filesToCreate && configuration.filesToCreate.length > 0) || 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 { + return client.handleExternalDrop(target, originalEvent); const droppedResources = extractResources(originalEvent.browserEvent as DragEvent, true); // Check for dropped external files to be folders diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 2975294e75..73ffb6362d 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -38,6 +38,7 @@ import { TerminalPanel } from 'vs/workbench/parts/terminal/electron-browser/term import { TerminalPickerHandler } from 'vs/workbench/parts/terminal/browser/terminalQuickOpen'; import { setupTerminalCommands, TERMINAL_COMMAND_ID } from 'vs/workbench/parts/terminal/common/terminalCommands'; import { setupTerminalMenu } from 'vs/workbench/parts/terminal/common/terminalMenu'; +import { client } from "../../../../../../../../packages/vscode"; const quickOpenRegistry = (Registry.as(QuickOpenExtensions.Quickopen)); @@ -434,9 +435,11 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousTer actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(TerminalPasteAction, TerminalPasteAction.ID, TerminalPasteAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_V }, + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V }, // Don't apply to Mac since cmd+v works mac: { primary: 0 } -}, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Paste into Active Terminal', category); +// }, KEYBINDING_CONTEXT_TERMINAL_FOCUS), 'Terminal: Paste into Active Terminal', category); +}, ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FOCUS, client.clipboardContextKey)), 'Terminal: Paste into Active Terminal', category); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(SelectAllTerminalAction, SelectAllTerminalAction.ID, SelectAllTerminalAction.LABEL, { // Don't use ctrl+a by default as that would override the common go to start // of prompt shell binding diff --git a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts index 7b4e8721ac..8f26dc2f28 100644 --- a/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts +++ b/src/vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider.ts @@ -28,7 +28,9 @@ export class WalkThroughContentProvider implements ITextModelContentProvider, IW public provideTextContent(resource: URI): Thenable { const query = resource.query ? JSON.parse(resource.query) : {}; const content: Thenable = (query.moduleId ? new Promise((resolve, reject) => { - require([query.moduleId], content => { + // Webpack needs this to be static or it can't include it. + import("vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page").then((content) => { + // require([query.moduleId], content => { try { resolve(content.default()); } catch (err) { 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 @@ -178,7 +178,7 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i const iconThemeDocumentLocationDirname = resources.dirname(iconThemeDocumentLocation); function resolvePath(path: string) { - return resources.joinPath(iconThemeDocumentLocationDirname, path); + return "/resource" + resources.joinPath(iconThemeDocumentLocationDirname, path).path; } function collectSelectors(associations: IconsAssociation, baseThemeClassName?: string) {