Set platform based on server (#32)
* Set platform based on server Had to refactor a bit to ensure our values get set before VS Code tries to use them. * Pave the way for mnemonics on all platforms * Fix context menus on Mac * Fix a bunch of things on Mac including menu bar * Set keybindings based on client's OS
This commit is contained in:
parent
0c2c957312
commit
14da71499f
@ -5,6 +5,7 @@ import { upload } from "./upload";
|
|||||||
import { client } from "./fill/client";
|
import { client } from "./fill/client";
|
||||||
import { clipboard } from "./fill/clipboard";
|
import { clipboard } from "./fill/clipboard";
|
||||||
import { INotificationService, IProgressService } from "./fill/notification";
|
import { INotificationService, IProgressService } from "./fill/notification";
|
||||||
|
import "./fill/os"; // Ensure it fills before anything else waiting on initData.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A general abstraction of an IDE client.
|
* A general abstraction of an IDE client.
|
||||||
|
@ -78,7 +78,7 @@ export class Dialog {
|
|||||||
this.buttons = this.options.buttons.map((buttonText, buttonIndex) => {
|
this.buttons = this.options.buttons.map((buttonText, buttonIndex) => {
|
||||||
const button = document.createElement("button");
|
const button = document.createElement("button");
|
||||||
// TODO: support mnemonics.
|
// TODO: support mnemonics.
|
||||||
button.innerText = buttonText.replace("_", "");
|
button.innerText = buttonText.replace("&&", "");
|
||||||
button.addEventListener("click", () => {
|
button.addEventListener("click", () => {
|
||||||
this.actionEmitter.emit({
|
this.actionEmitter.emit({
|
||||||
buttonIndex,
|
buttonIndex,
|
||||||
|
@ -145,6 +145,14 @@ class Clipboard {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public readFindText(): string {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public writeFindText(_text: string): void {
|
||||||
|
// Nothing.
|
||||||
|
}
|
||||||
|
|
||||||
public writeText(value: string): Promise<void> {
|
public writeText(value: string): Promise<void> {
|
||||||
return clipboard.writeText(value);
|
return clipboard.writeText(value);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import { InitData } from "@coder/protocol";
|
import { OperatingSystem, InitData } from "@coder/protocol";
|
||||||
import { client } from "./client";
|
import { client } from "./client";
|
||||||
|
|
||||||
class OS {
|
class OS {
|
||||||
private _homedir: string | undefined;
|
private _homedir: string | undefined;
|
||||||
private _tmpdir: string | undefined;
|
private _tmpdir: string | undefined;
|
||||||
|
private _platform: NodeJS.Platform | undefined;
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
client.initData.then((data) => {
|
client.initData.then((d) => this.initialize(d));
|
||||||
this.initialize(data);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public homedir(): string {
|
public homedir(): string {
|
||||||
@ -30,6 +29,11 @@ class OS {
|
|||||||
public initialize(data: InitData): void {
|
public initialize(data: InitData): void {
|
||||||
this._homedir = data.homeDirectory;
|
this._homedir = data.homeDirectory;
|
||||||
this._tmpdir = data.tmpDirectory;
|
this._tmpdir = data.tmpDirectory;
|
||||||
|
switch (data.os) {
|
||||||
|
case OperatingSystem.Windows: this._platform = "win32"; break;
|
||||||
|
case OperatingSystem.Mac: this._platform = "darwin"; break;
|
||||||
|
default: this._platform = "linux"; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public release(): string {
|
public release(): string {
|
||||||
@ -37,14 +41,11 @@ class OS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public platform(): NodeJS.Platform {
|
public platform(): NodeJS.Platform {
|
||||||
if (navigator.appVersion.indexOf("Win") != -1) {
|
if (typeof this._platform === "undefined") {
|
||||||
return "win32";
|
throw new Error("trying to access platform before it has been set");
|
||||||
}
|
|
||||||
if (navigator.appVersion.indexOf("Mac") != -1) {
|
|
||||||
return "darwin";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "linux";
|
return this._platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3336,6 +3336,13 @@ source-map@~0.1.38:
|
|||||||
dependencies:
|
dependencies:
|
||||||
amdefine ">=0.0.4"
|
amdefine ">=0.0.4"
|
||||||
|
|
||||||
|
sourcemap-blender@1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/sourcemap-blender/-/sourcemap-blender-1.0.5.tgz#d361f3d12381c4e477178113878fdf984a91bdbc"
|
||||||
|
integrity sha512-GPhjCmDtJ8YY6zt1L6kP6WtBg6WrdWt5hw2Wmgt9rwC3yiwLo9vEuabh/YYSZ5KmFV20hVkGdkTwpXtT2E65TA==
|
||||||
|
dependencies:
|
||||||
|
source-map "^0.7.3"
|
||||||
|
|
||||||
split-string@^3.0.1, split-string@^3.0.2:
|
split-string@^3.0.1, split-string@^3.0.2:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
||||||
|
@ -1,216 +1,21 @@
|
|||||||
|
import { IdeClient } from "@coder/ide";
|
||||||
import * as paths from "./fill/paths";
|
import * as paths from "./fill/paths";
|
||||||
import "./fill/platform";
|
|
||||||
import "./fill/storageDatabase";
|
|
||||||
import "./fill/windowsService";
|
|
||||||
import "./fill/workspacesService";
|
|
||||||
import "./fill/environmentService";
|
|
||||||
import "./fill/vscodeTextmate";
|
|
||||||
import "./fill/codeEditor";
|
|
||||||
import "./fill/mouseEvent";
|
|
||||||
import "./fill/menuRegistry";
|
|
||||||
import "./fill/workbenchRegistry";
|
|
||||||
import { PasteAction } from "./fill/paste";
|
|
||||||
import "./fill/dom";
|
|
||||||
import "./vscode.scss";
|
import "./vscode.scss";
|
||||||
import { IdeClient, IProgress, INotificationHandle } from "@coder/ide";
|
// NOTE: shouldn't import anything from VS Code here or anything that will
|
||||||
import { registerContextMenuListener } from "vs/base/parts/contextmenu/electron-main/contextmenu";
|
// depend on a synchronous fill like `os`.
|
||||||
import { LogLevel } from "vs/platform/log/common/log";
|
|
||||||
import { URI } from "vs/base/common/uri";
|
|
||||||
import { INotificationService } from "vs/platform/notification/common/notification";
|
|
||||||
import { IProgressService2, ProgressLocation } from "vs/platform/progress/common/progress";
|
|
||||||
import { ExplorerItem, ExplorerModel } from "vs/workbench/parts/files/common/explorerModel";
|
|
||||||
import { DragMouseEvent } from "vs/base/browser/mouseEvent";
|
|
||||||
import { IEditorService, IResourceEditor } from "vs/workbench/services/editor/common/editorService";
|
|
||||||
import { IEditorGroup } from "vs/workbench/services/group/common/editorGroupsService";
|
|
||||||
import { IWindowsService, IWindowConfiguration } from "vs/platform/windows/common/windows";
|
|
||||||
import { ServiceCollection } from "vs/platform/instantiation/common/serviceCollection";
|
|
||||||
import { RawContextKey, IContextKeyService } from "vs/platform/contextkey/common/contextkey";
|
|
||||||
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces";
|
|
||||||
|
|
||||||
export class Client extends IdeClient {
|
|
||||||
private readonly windowId = parseInt(new Date().toISOString().replace(/[-:.TZ]/g, ""), 10);
|
|
||||||
private _serviceCollection: ServiceCollection | undefined;
|
|
||||||
private _clipboardContextKey: RawContextKey<boolean> | undefined;
|
|
||||||
private _builtInExtensionsDirectory: string | undefined;
|
|
||||||
|
|
||||||
public get builtInExtensionsDirectory(): string {
|
|
||||||
if (!this._builtInExtensionsDirectory) {
|
|
||||||
throw new Error("trying to access builtin extensions directory before it has been set");
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._builtInExtensionsDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async handleExternalDrop(target: ExplorerItem | ExplorerModel, originalEvent: DragEvent): Promise<void> {
|
|
||||||
await this.upload.uploadDropped(
|
|
||||||
originalEvent,
|
|
||||||
(target instanceof ExplorerItem ? target : target.roots[0]).resource,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup, afterDrop: (targetGroup: IEditorGroup) => void, targetIndex?: number): void {
|
|
||||||
this.initData.then((d) => {
|
|
||||||
this.upload.uploadDropped(event, URI.file(d.workingDirectory)).then((paths) => {
|
|
||||||
const uris = paths.map((p) => URI.file(p));
|
|
||||||
if (uris.length) {
|
|
||||||
(this.serviceCollection.get(IWindowsService) as IWindowsService).addRecentlyOpened(uris);
|
|
||||||
}
|
|
||||||
|
|
||||||
const editors: IResourceEditor[] = uris.map(uri => ({
|
|
||||||
resource: uri,
|
|
||||||
options: {
|
|
||||||
pinned: true,
|
|
||||||
index: targetIndex,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
const targetGroup = resolveTargetGroup();
|
|
||||||
|
|
||||||
(this.serviceCollection.get(IEditorService) as IEditorService).openEditors(editors, targetGroup).then(() => {
|
|
||||||
afterDrop(targetGroup);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use to toggle the paste option inside editors based on the native clipboard.
|
|
||||||
*/
|
|
||||||
public get clipboardContextKey(): RawContextKey<boolean> {
|
|
||||||
if (!this._clipboardContextKey) {
|
|
||||||
throw new Error("Trying to access clipboard context key before it has been set");
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._clipboardContextKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get clipboardText(): Promise<string> {
|
|
||||||
return this.clipboard.readText();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a paste action for use in text inputs.
|
|
||||||
*/
|
|
||||||
public get pasteAction(): PasteAction {
|
|
||||||
return new PasteAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
public set workspace(ws: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | undefined) {
|
|
||||||
if (typeof ws === "undefined") {
|
|
||||||
window.localStorage.removeItem("workspace");
|
|
||||||
} else {
|
|
||||||
window.localStorage.setItem("workspace", JSON.stringify(ws));
|
|
||||||
}
|
|
||||||
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public get workspace(): undefined | IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier {
|
|
||||||
const ws = window.localStorage.getItem("workspace");
|
|
||||||
try {
|
|
||||||
return JSON.parse(ws!);
|
|
||||||
} catch (ex) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public get serviceCollection(): ServiceCollection {
|
|
||||||
if (!this._serviceCollection) {
|
|
||||||
throw new Error("Trying to access service collection before it has been set");
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._serviceCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set serviceCollection(collection: ServiceCollection) {
|
|
||||||
this._serviceCollection = collection;
|
|
||||||
this.progressService = {
|
|
||||||
start: <T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T> => {
|
|
||||||
let lastProgress = 0;
|
|
||||||
|
|
||||||
return (this.serviceCollection.get(IProgressService2) as IProgressService2).withProgress({
|
|
||||||
location: ProgressLocation.Notification,
|
|
||||||
title,
|
|
||||||
cancellable: true,
|
|
||||||
}, (progress) => {
|
|
||||||
return task({
|
|
||||||
report: (p): void => {
|
|
||||||
progress.report({ increment: p - lastProgress });
|
|
||||||
lastProgress = p;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, () => {
|
|
||||||
onCancel();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
this.notificationService = {
|
|
||||||
error: (error: Error): void => (this.serviceCollection.get(INotificationService) as INotificationService).error(error),
|
|
||||||
prompt: (severity, message, buttons, onCancel): INotificationHandle => {
|
|
||||||
const handle = (this.serviceCollection.get(INotificationService) as INotificationService).prompt(
|
|
||||||
severity, message, buttons, { onCancel },
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
close: (): void => handle.close(),
|
|
||||||
updateMessage: (message): void => handle.updateMessage(message),
|
|
||||||
updateButtons: (buttons): void => handle.updateActions({
|
|
||||||
primary: buttons.map((button) => ({
|
|
||||||
id: "",
|
|
||||||
label: button.label,
|
|
||||||
tooltip: "",
|
|
||||||
class: undefined,
|
|
||||||
enabled: true,
|
|
||||||
checked: false,
|
|
||||||
radio: false,
|
|
||||||
dispose: (): void => undefined,
|
|
||||||
run: (): Promise<void> => Promise.resolve(button.run()),
|
|
||||||
})),
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class VSClient extends IdeClient {
|
||||||
protected initialize(): Promise<void> {
|
protected initialize(): Promise<void> {
|
||||||
registerContextMenuListener();
|
|
||||||
|
|
||||||
this._clipboardContextKey = new RawContextKey("nativeClipboard", this.clipboard.isEnabled);
|
|
||||||
|
|
||||||
return this.task("Start workbench", 1000, async (data, sharedData) => {
|
return this.task("Start workbench", 1000, async (data, sharedData) => {
|
||||||
paths._paths.initialize(data, sharedData);
|
paths._paths.initialize(data, sharedData);
|
||||||
this._builtInExtensionsDirectory = data.builtInExtensionsDirectory;
|
|
||||||
process.env.SHELL = data.shell;
|
process.env.SHELL = data.shell;
|
||||||
|
// At this point everything should be filled, including `os`. `os` also
|
||||||
const workspace = this.workspace || URI.file(data.workingDirectory);
|
// relies on `initData` but it listens first so it initialize before this
|
||||||
const { startup } = require("./startup") as typeof import("vs/workbench/electron-browser/main");
|
// callback, meaning we are safe to include everything from VS Code now.
|
||||||
const config: IWindowConfiguration = {
|
const { workbench } = require("./workbench") as typeof import("./workbench");
|
||||||
machineId: "1",
|
await workbench.initialize();
|
||||||
windowId: this.windowId,
|
|
||||||
logLevel: LogLevel.Info,
|
|
||||||
mainPid: 1,
|
|
||||||
appRoot: data.dataDirectory,
|
|
||||||
execPath: data.tmpDirectory,
|
|
||||||
userEnv: {},
|
|
||||||
nodeCachedDataDir: data.tmpDirectory,
|
|
||||||
perfEntries: [],
|
|
||||||
_: [],
|
|
||||||
};
|
|
||||||
if ((workspace as IWorkspaceIdentifier).configPath) {
|
|
||||||
config.workspace = workspace as IWorkspaceIdentifier;
|
|
||||||
} else {
|
|
||||||
config.folderUri = workspace as URI;
|
|
||||||
}
|
|
||||||
await startup(config);
|
|
||||||
const contextKeys = this.serviceCollection.get(IContextKeyService) as IContextKeyService;
|
|
||||||
const bounded = this.clipboardContextKey.bindTo(contextKeys);
|
|
||||||
this.clipboard.onPermissionChange((enabled) => {
|
|
||||||
bounded.set(enabled);
|
|
||||||
});
|
|
||||||
this.clipboard.initialize();
|
|
||||||
}, this.initData, this.sharedProcessData);
|
}, this.initData, this.sharedProcessData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const client = new Client();
|
export const client = new VSClient();
|
||||||
|
@ -3,7 +3,7 @@ import * as environment from "vs/platform/environment/node/environmentService";
|
|||||||
|
|
||||||
export class EnvironmentService extends environment.EnvironmentService {
|
export class EnvironmentService extends environment.EnvironmentService {
|
||||||
public get sharedIPCHandle(): string {
|
public get sharedIPCHandle(): string {
|
||||||
return paths._paths.socketPath || super.sharedIPCHandle;
|
return paths.getSocketPath() || super.sharedIPCHandle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
packages/vscode/src/fill/labels.ts
Normal file
10
packages/vscode/src/fill/labels.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as labels from "vs/base/common/labels";
|
||||||
|
|
||||||
|
// Here we simply disable translation of mnemonics and leave everything as &&.
|
||||||
|
// Since we're in the browser, we can handle all platforms in the same way.
|
||||||
|
const target = labels as typeof labels;
|
||||||
|
target.mnemonicMenuLabel = (label: string, forceDisable?: boolean): string => {
|
||||||
|
return forceDisable ? label.replace(/\(&&\w\)|&&/g, "") : label;
|
||||||
|
};
|
||||||
|
target.mnemonicButtonLabel = (label: string): string => { return label; };
|
||||||
|
target.unmnemonicLabel = (label: string): string => { return label; };
|
@ -4,7 +4,7 @@ import { TERMINAL_COMMAND_ID } from "vs/workbench/parts/terminal/common/terminal
|
|||||||
import { ITerminalService } from "vs/workbench/parts/terminal/common/terminal";
|
import { ITerminalService } from "vs/workbench/parts/terminal/common/terminal";
|
||||||
import * as actions from "vs/workbench/parts/terminal/electron-browser/terminalActions";
|
import * as actions from "vs/workbench/parts/terminal/electron-browser/terminalActions";
|
||||||
import * as instance from "vs/workbench/parts/terminal/electron-browser/terminalInstance";
|
import * as instance from "vs/workbench/parts/terminal/electron-browser/terminalInstance";
|
||||||
import { clipboard } from "@coder/ide";
|
import { client } from "../client";
|
||||||
|
|
||||||
const getLabel = (key: string, enabled: boolean): string => {
|
const getLabel = (key: string, enabled: boolean): string => {
|
||||||
return enabled
|
return enabled
|
||||||
@ -18,13 +18,13 @@ export class PasteAction extends Action {
|
|||||||
public constructor() {
|
public constructor() {
|
||||||
super(
|
super(
|
||||||
"editor.action.clipboardPasteAction",
|
"editor.action.clipboardPasteAction",
|
||||||
getLabel(PasteAction.KEY, clipboard.isEnabled),
|
getLabel(PasteAction.KEY, client.clipboard.isEnabled),
|
||||||
undefined,
|
undefined,
|
||||||
clipboard.isEnabled,
|
client.clipboard.isEnabled,
|
||||||
async (): Promise<boolean> => clipboard.paste(),
|
async (): Promise<boolean> => client.clipboard.paste(),
|
||||||
);
|
);
|
||||||
|
|
||||||
clipboard.onPermissionChange((enabled) => {
|
client.clipboard.onPermissionChange((enabled) => {
|
||||||
this.label = getLabel(PasteAction.KEY, enabled);
|
this.label = getLabel(PasteAction.KEY, enabled);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
});
|
});
|
||||||
@ -36,17 +36,17 @@ class TerminalPasteAction extends Action {
|
|||||||
|
|
||||||
public static readonly ID = TERMINAL_COMMAND_ID.PASTE;
|
public static readonly ID = TERMINAL_COMMAND_ID.PASTE;
|
||||||
public static readonly LABEL = nls.localize("workbench.action.terminal.paste", "Paste into Active Terminal");
|
public static readonly LABEL = nls.localize("workbench.action.terminal.paste", "Paste into Active Terminal");
|
||||||
public static readonly SHORT_LABEL = getLabel(TerminalPasteAction.KEY, clipboard.isEnabled);
|
public static readonly SHORT_LABEL = getLabel(TerminalPasteAction.KEY, client.clipboard.isEnabled);
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
id: string, label: string,
|
id: string, label: string,
|
||||||
@ITerminalService private terminalService: ITerminalService,
|
@ITerminalService private terminalService: ITerminalService,
|
||||||
) {
|
) {
|
||||||
super(id, label);
|
super(id, label);
|
||||||
clipboard.onPermissionChange((enabled) => {
|
client.clipboard.onPermissionChange((enabled) => {
|
||||||
this._setLabel(getLabel(TerminalPasteAction.KEY, enabled));
|
this._setLabel(getLabel(TerminalPasteAction.KEY, enabled));
|
||||||
});
|
});
|
||||||
this._setLabel(getLabel(TerminalPasteAction.KEY, clipboard.isEnabled));
|
this._setLabel(getLabel(TerminalPasteAction.KEY, client.clipboard.isEnabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(): Promise<void> {
|
public run(): Promise<void> {
|
||||||
@ -63,8 +63,8 @@ class TerminalPasteAction extends Action {
|
|||||||
class TerminalInstance extends instance.TerminalInstance {
|
class TerminalInstance extends instance.TerminalInstance {
|
||||||
public async paste(): Promise<void> {
|
public async paste(): Promise<void> {
|
||||||
this.focus();
|
this.focus();
|
||||||
if (clipboard.isEnabled) {
|
if (client.clipboard.isEnabled) {
|
||||||
const text = await clipboard.readText();
|
const text = await client.clipboard.readText();
|
||||||
this.sendText(text, false);
|
this.sendText(text, false);
|
||||||
} else {
|
} else {
|
||||||
document.execCommand("paste");
|
document.execCommand("paste");
|
||||||
|
@ -4,6 +4,8 @@ class Paths {
|
|||||||
private _appData: string | undefined;
|
private _appData: string | undefined;
|
||||||
private _defaultUserData: string | undefined;
|
private _defaultUserData: string | undefined;
|
||||||
private _socketPath: string | undefined;
|
private _socketPath: string | undefined;
|
||||||
|
private _builtInExtensionsDirectory: string | undefined;
|
||||||
|
private _workingDirectory: string | undefined;
|
||||||
|
|
||||||
public get appData(): string {
|
public get appData(): string {
|
||||||
if (typeof this._appData === "undefined") {
|
if (typeof this._appData === "undefined") {
|
||||||
@ -29,14 +31,35 @@ class Paths {
|
|||||||
return this._socketPath;
|
return this._socketPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get builtInExtensionsDirectory(): string {
|
||||||
|
if (!this._builtInExtensionsDirectory) {
|
||||||
|
throw new Error("trying to access builtin extensions directory before it has been set");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._builtInExtensionsDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get workingDirectory(): string {
|
||||||
|
if (!this._workingDirectory) {
|
||||||
|
throw new Error("trying to access working directory before it has been set");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._workingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
public initialize(data: InitData, sharedData: SharedProcessData): void {
|
public initialize(data: InitData, sharedData: SharedProcessData): void {
|
||||||
process.env.VSCODE_LOGS = sharedData.logPath;
|
process.env.VSCODE_LOGS = sharedData.logPath;
|
||||||
this._appData = data.dataDirectory;
|
this._appData = data.dataDirectory;
|
||||||
this._defaultUserData = data.dataDirectory;
|
this._defaultUserData = data.dataDirectory;
|
||||||
this._socketPath = sharedData.socketPath;
|
this._socketPath = sharedData.socketPath;
|
||||||
|
this._builtInExtensionsDirectory = data.builtInExtensionsDirectory;
|
||||||
|
this._workingDirectory = data.workingDirectory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const _paths = new Paths();
|
export const _paths = new Paths();
|
||||||
export const getAppDataPath = (): string => _paths.appData;
|
export const getAppDataPath = (): string => _paths.appData;
|
||||||
export const getDefaultUserDataPath = (): string => _paths.defaultUserData;
|
export const getDefaultUserDataPath = (): string => _paths.defaultUserData;
|
||||||
|
export const getWorkingDirectory = (): string => _paths.workingDirectory;
|
||||||
|
export const getBuiltInExtensionsDirectory = (): string => _paths.builtInExtensionsDirectory;
|
||||||
|
export const getSocketPath = (): string => _paths.socketPath;
|
||||||
|
@ -1,12 +1,25 @@
|
|||||||
|
import * as os from "os";
|
||||||
import * as platform from "vs/base/common/platform";
|
import * as platform from "vs/base/common/platform";
|
||||||
|
|
||||||
|
// tslint:disable no-any to override const
|
||||||
|
|
||||||
// Use en instead of en-US since that's vscode default and it uses
|
// Use en instead of en-US since that's vscode default and it uses
|
||||||
// that to determine whether to output aliases which will be redundant.
|
// that to determine whether to output aliases which will be redundant.
|
||||||
if (platform.locale === "en-US") {
|
if (platform.locale === "en-US") {
|
||||||
// tslint:disable-next-line no-any to override const
|
|
||||||
(platform as any).locale = "en";
|
(platform as any).locale = "en";
|
||||||
}
|
}
|
||||||
if (platform.language === "en-US") {
|
if (platform.language === "en-US") {
|
||||||
// tslint:disable-next-line no-any to override const
|
|
||||||
(platform as any).language = "en";
|
(platform as any).language = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the server's platform instead of the client's. For example, this affects
|
||||||
|
// how VS Code handles paths (and more) because different platforms give
|
||||||
|
// different results. We'll have to counter for things that shouldn't change,
|
||||||
|
// like keybindings.
|
||||||
|
(platform as any).isLinux = os.platform() === "linux";
|
||||||
|
(platform as any).isWindows = os.platform() === "win32";
|
||||||
|
(platform as any).isMacintosh = os.platform() === "darwin";
|
||||||
|
|
||||||
|
// This is used for keybindings, and in one place to choose between \r\n and \n
|
||||||
|
// (which we change to use platform.isWindows instead).
|
||||||
|
(platform as any).OS = (platform.isMacintosh ? platform.OperatingSystem.Macintosh : (platform.isWindows ? platform.OperatingSystem.Windows : platform.OperatingSystem.Linux));
|
||||||
|
@ -2,13 +2,13 @@ import { readFile, writeFile, mkdir } from "fs";
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import { IDisposable } from "@coder/disposable";
|
import { IDisposable } from "@coder/disposable";
|
||||||
|
import { logger, field } from "@coder/logger";
|
||||||
import { Event } from "vs/base/common/event";
|
import { Event } from "vs/base/common/event";
|
||||||
import * as workspaceStorage from "vs/base/node/storage";
|
import * as workspaceStorage from "vs/base/node/storage";
|
||||||
import * as globalStorage from "vs/platform/storage/node/storageIpc";
|
import * as globalStorage from "vs/platform/storage/node/storageIpc";
|
||||||
import * as paths from "./paths";
|
|
||||||
import { logger, field } from "@coder/logger";
|
|
||||||
import { client } from "@coder/vscode/src/client";
|
|
||||||
import { IStorageService, WillSaveStateReason } from "vs/platform/storage/common/storage";
|
import { IStorageService, WillSaveStateReason } from "vs/platform/storage/common/storage";
|
||||||
|
import * as paths from "./paths";
|
||||||
|
import { workbench } from "../workbench";
|
||||||
|
|
||||||
class StorageDatabase implements workspaceStorage.IStorageDatabase {
|
class StorageDatabase implements workspaceStorage.IStorageDatabase {
|
||||||
public readonly onDidChangeItemsExternal = Event.None;
|
public readonly onDidChangeItemsExternal = Event.None;
|
||||||
@ -80,7 +80,7 @@ class StorageDatabase implements workspaceStorage.IStorageDatabase {
|
|||||||
|
|
||||||
private triggerFlush(reason: WillSaveStateReason = WillSaveStateReason.NONE): boolean {
|
private triggerFlush(reason: WillSaveStateReason = WillSaveStateReason.NONE): boolean {
|
||||||
// tslint:disable-next-line:no-any
|
// tslint:disable-next-line:no-any
|
||||||
const storageService = client.serviceCollection.get<IStorageService>(IStorageService) as any;
|
const storageService = workbench.serviceCollection.get<IStorageService>(IStorageService) as any;
|
||||||
if (reason === WillSaveStateReason.SHUTDOWN && storageService.close) {
|
if (reason === WillSaveStateReason.SHUTDOWN && storageService.close) {
|
||||||
storageService.close();
|
storageService.close();
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import { IRecentlyOpened } from "vs/platform/history/common/history";
|
|||||||
import { ISerializableCommandAction } from "vs/platform/actions/common/actions";
|
import { ISerializableCommandAction } from "vs/platform/actions/common/actions";
|
||||||
import { client } from "../client";
|
import { client } from "../client";
|
||||||
import { showOpenDialog } from "../dialog";
|
import { showOpenDialog } from "../dialog";
|
||||||
|
import { workbench } from "../workbench";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instead of going to the shared process, we'll directly run these methods on
|
* Instead of going to the shared process, we'll directly run these methods on
|
||||||
@ -79,7 +80,7 @@ class WindowsService implements IWindowsService {
|
|||||||
openDirectory: true,
|
openDirectory: true,
|
||||||
},
|
},
|
||||||
}).then((path) => {
|
}).then((path) => {
|
||||||
client.workspace = URI.file(path);
|
workbench.workspace = URI.file(path);
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
//
|
//
|
||||||
});
|
});
|
||||||
@ -150,12 +151,12 @@ class WindowsService implements IWindowsService {
|
|||||||
|
|
||||||
public enterWorkspace(_windowId: number, _path: URI): Promise<IEnterWorkspaceResult> {
|
public enterWorkspace(_windowId: number, _path: URI): Promise<IEnterWorkspaceResult> {
|
||||||
if (_path.path.endsWith(".json")) {
|
if (_path.path.endsWith(".json")) {
|
||||||
client.workspace = {
|
workbench.workspace = {
|
||||||
id: "Untitled",
|
id: "Untitled",
|
||||||
configPath: _path.path,
|
configPath: _path.path,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
client.workspace = _path;
|
workbench.workspace = _path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined!;
|
return undefined!;
|
||||||
|
@ -8,7 +8,7 @@ import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/deve
|
|||||||
import { TerminalPasteAction } from "vs/workbench/parts/terminal/electron-browser/terminalActions";
|
import { TerminalPasteAction } from "vs/workbench/parts/terminal/electron-browser/terminalActions";
|
||||||
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/parts/terminal/common/terminal";
|
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/parts/terminal/common/terminal";
|
||||||
import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
|
import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
|
||||||
import { client } from "../client";
|
import { workbench } from "../workbench";
|
||||||
|
|
||||||
// Intercept adding workbench actions so we can skip actions that won't work or
|
// Intercept adding workbench actions so we can skip actions that won't work or
|
||||||
// modify actions that need different conditions, keybindings, etc.
|
// modify actions that need different conditions, keybindings, etc.
|
||||||
@ -32,7 +32,7 @@ registry.registerWorkbenchAction = (descriptor: SyncActionDescriptor, alias: str
|
|||||||
mac: { primary: 0 },
|
mac: { primary: 0 },
|
||||||
};
|
};
|
||||||
// tslint:disable-next-line no-any override private
|
// tslint:disable-next-line no-any override private
|
||||||
(descriptor as any)._keybindingContext = ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FOCUS, client.clipboardContextKey);
|
(descriptor as any)._keybindingContext = ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FOCUS, workbench.clipboardContextKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return originalRegister(descriptor, alias, category, when);
|
return originalRegister(descriptor, alias, category, when);
|
||||||
|
@ -4,7 +4,7 @@ import { ILogService } from "vs/platform/log/common/log";
|
|||||||
import { IWorkspaceFolderCreationData, IWorkspaceIdentifier, IWorkspacesService } from "vs/platform/workspaces/common/workspaces";
|
import { IWorkspaceFolderCreationData, IWorkspaceIdentifier, IWorkspacesService } from "vs/platform/workspaces/common/workspaces";
|
||||||
import { WorkspacesMainService } from "vs/platform/workspaces/electron-main/workspacesMainService";
|
import { WorkspacesMainService } from "vs/platform/workspaces/electron-main/workspacesMainService";
|
||||||
import * as workspacesIpc from "vs/platform/workspaces/node/workspacesIpc";
|
import * as workspacesIpc from "vs/platform/workspaces/node/workspacesIpc";
|
||||||
import { client } from "../client";
|
import { workbench } from "../workbench";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instead of going to the shared process, we'll directly run these methods on
|
* Instead of going to the shared process, we'll directly run these methods on
|
||||||
@ -16,8 +16,8 @@ class WorkspacesService implements IWorkspacesService {
|
|||||||
|
|
||||||
public createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[] | undefined): Promise<IWorkspaceIdentifier> {
|
public createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[] | undefined): Promise<IWorkspaceIdentifier> {
|
||||||
const mainService = new WorkspacesMainService(
|
const mainService = new WorkspacesMainService(
|
||||||
client.serviceCollection.get<IEnvironmentService>(IEnvironmentService) as IEnvironmentService,
|
workbench.serviceCollection.get<IEnvironmentService>(IEnvironmentService) as IEnvironmentService,
|
||||||
client.serviceCollection.get<ILogService>(ILogService) as ILogService,
|
workbench.serviceCollection.get<ILogService>(ILogService) as ILogService,
|
||||||
);
|
);
|
||||||
|
|
||||||
// lib/vscode/src/vs/platform/workspaces/node/workspacesIpc.ts
|
// lib/vscode/src/vs/platform/workspaces/node/workspacesIpc.ts
|
||||||
|
@ -1,183 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import "vs/loader";
|
|
||||||
|
|
||||||
//#region --- workbench/editor core
|
|
||||||
|
|
||||||
import "vs/editor/editor.all";
|
|
||||||
|
|
||||||
import "vs/workbench/api/electron-browser/extensionHost.contribution";
|
|
||||||
|
|
||||||
import "vs/workbench/electron-browser/shell.contribution";
|
|
||||||
import "vs/workbench/browser/workbench.contribution";
|
|
||||||
|
|
||||||
import { startup } from "vs/workbench/electron-browser/main";
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region --- workbench actions
|
|
||||||
|
|
||||||
import "vs/workbench/browser/actions/layoutActions";
|
|
||||||
import "vs/workbench/browser/actions/listCommands";
|
|
||||||
import "vs/workbench/browser/actions/navigationActions";
|
|
||||||
import "vs/workbench/browser/parts/quickopen/quickOpenActions";
|
|
||||||
import "vs/workbench/browser/parts/quickinput/quickInputActions";
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region --- API Extension Points
|
|
||||||
|
|
||||||
import "vs/workbench/api/common/menusExtensionPoint";
|
|
||||||
import "vs/workbench/api/common/configurationExtensionPoint";
|
|
||||||
import "vs/workbench/api/browser/viewsExtensionPoint";
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region --- workbench services
|
|
||||||
|
|
||||||
import "vs/workbench/services/bulkEdit/electron-browser/bulkEditService";
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region --- workbench parts
|
|
||||||
|
|
||||||
// Localizations
|
|
||||||
import "vs/workbench/parts/localizations/electron-browser/localizations.contribution";
|
|
||||||
|
|
||||||
// Preferences
|
|
||||||
import "vs/workbench/parts/preferences/electron-browser/preferences.contribution";
|
|
||||||
import "vs/workbench/parts/preferences/browser/keybindingsEditorContribution";
|
|
||||||
|
|
||||||
// Logs
|
|
||||||
import "vs/workbench/parts/logs/electron-browser/logs.contribution";
|
|
||||||
|
|
||||||
// Quick Open Handlers
|
|
||||||
import "vs/workbench/parts/quickopen/browser/quickopen.contribution";
|
|
||||||
|
|
||||||
// Explorer
|
|
||||||
import "vs/workbench/parts/files/electron-browser/explorerViewlet";
|
|
||||||
import "vs/workbench/parts/files/electron-browser/fileActions.contribution";
|
|
||||||
import "vs/workbench/parts/files/electron-browser/files.contribution";
|
|
||||||
|
|
||||||
// Backup
|
|
||||||
import "vs/workbench/parts/backup/common/backup.contribution";
|
|
||||||
|
|
||||||
// Stats
|
|
||||||
import "vs/workbench/parts/stats/node/stats.contribution";
|
|
||||||
|
|
||||||
// Rapid Render Splash
|
|
||||||
import "vs/workbench/parts/splash/electron-browser/partsSplash.contribution";
|
|
||||||
|
|
||||||
// Search
|
|
||||||
import "vs/workbench/parts/search/electron-browser/search.contribution";
|
|
||||||
import "vs/workbench/parts/search/browser/searchView";
|
|
||||||
import "vs/workbench/parts/search/browser/openAnythingHandler";
|
|
||||||
|
|
||||||
// SCM
|
|
||||||
import "vs/workbench/parts/scm/electron-browser/scm.contribution";
|
|
||||||
import "vs/workbench/parts/scm/electron-browser/scmViewlet";
|
|
||||||
|
|
||||||
// Debug
|
|
||||||
import "vs/workbench/parts/debug/electron-browser/debug.contribution";
|
|
||||||
import "vs/workbench/parts/debug/browser/debugQuickOpen";
|
|
||||||
import "vs/workbench/parts/debug/electron-browser/repl";
|
|
||||||
import "vs/workbench/parts/debug/browser/debugViewlet";
|
|
||||||
|
|
||||||
// Markers
|
|
||||||
import "vs/workbench/parts/markers/electron-browser/markers.contribution";
|
|
||||||
|
|
||||||
// Comments
|
|
||||||
import "vs/workbench/parts/comments/electron-browser/comments.contribution";
|
|
||||||
|
|
||||||
// HTML Preview
|
|
||||||
import "vs/workbench/parts/html/electron-browser/html.contribution";
|
|
||||||
|
|
||||||
// URL Support
|
|
||||||
import "vs/workbench/parts/url/electron-browser/url.contribution";
|
|
||||||
|
|
||||||
// Webview
|
|
||||||
import "vs/workbench/parts/webview/electron-browser/webview.contribution";
|
|
||||||
|
|
||||||
// Extensions Management
|
|
||||||
import "vs/workbench/parts/extensions/electron-browser/extensions.contribution";
|
|
||||||
import "vs/workbench/parts/extensions/browser/extensionsQuickOpen";
|
|
||||||
import "vs/workbench/parts/extensions/electron-browser/extensionsViewlet";
|
|
||||||
|
|
||||||
// Output Panel
|
|
||||||
import "vs/workbench/parts/output/electron-browser/output.contribution";
|
|
||||||
import "vs/workbench/parts/output/browser/outputPanel";
|
|
||||||
|
|
||||||
// Terminal
|
|
||||||
import "vs/workbench/parts/terminal/electron-browser/terminal.contribution";
|
|
||||||
import "vs/workbench/parts/terminal/browser/terminalQuickOpen";
|
|
||||||
import "vs/workbench/parts/terminal/electron-browser/terminalPanel";
|
|
||||||
|
|
||||||
// Relauncher
|
|
||||||
import "vs/workbench/parts/relauncher/electron-browser/relauncher.contribution";
|
|
||||||
|
|
||||||
// Tasks
|
|
||||||
import "vs/workbench/parts/tasks/electron-browser/task.contribution";
|
|
||||||
|
|
||||||
// Emmet
|
|
||||||
import "vs/workbench/parts/emmet/browser/emmet.browser.contribution";
|
|
||||||
import "vs/workbench/parts/emmet/electron-browser/emmet.contribution";
|
|
||||||
|
|
||||||
// CodeEditor Contributions
|
|
||||||
import "vs/workbench/parts/codeEditor/electron-browser/codeEditor.contribution";
|
|
||||||
|
|
||||||
// Execution
|
|
||||||
import "vs/workbench/parts/execution/electron-browser/execution.contribution";
|
|
||||||
|
|
||||||
// Snippets
|
|
||||||
import "vs/workbench/parts/snippets/electron-browser/snippets.contribution";
|
|
||||||
import "vs/workbench/parts/snippets/electron-browser/snippetsService";
|
|
||||||
import "vs/workbench/parts/snippets/electron-browser/insertSnippet";
|
|
||||||
import "vs/workbench/parts/snippets/electron-browser/configureSnippets";
|
|
||||||
import "vs/workbench/parts/snippets/electron-browser/tabCompletion";
|
|
||||||
|
|
||||||
// Send a Smile
|
|
||||||
import "vs/workbench/parts/feedback/electron-browser/feedback.contribution";
|
|
||||||
|
|
||||||
// Update
|
|
||||||
import "vs/workbench/parts/update/electron-browser/update.contribution";
|
|
||||||
|
|
||||||
// Surveys
|
|
||||||
import "vs/workbench/parts/surveys/electron-browser/nps.contribution";
|
|
||||||
import "vs/workbench/parts/surveys/electron-browser/languageSurveys.contribution";
|
|
||||||
|
|
||||||
// Performance
|
|
||||||
import "vs/workbench/parts/performance/electron-browser/performance.contribution";
|
|
||||||
|
|
||||||
// CLI
|
|
||||||
import "vs/workbench/parts/cli/electron-browser/cli.contribution";
|
|
||||||
|
|
||||||
// Themes Support
|
|
||||||
import "vs/workbench/parts/themes/electron-browser/themes.contribution";
|
|
||||||
import "vs/workbench/parts/themes/test/electron-browser/themes.test.contribution";
|
|
||||||
|
|
||||||
// Watermark
|
|
||||||
import "vs/workbench/parts/watermark/electron-browser/watermark";
|
|
||||||
|
|
||||||
// Welcome
|
|
||||||
import "vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution";
|
|
||||||
import "vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution";
|
|
||||||
import "vs/workbench/parts/welcome/overlay/browser/welcomeOverlay";
|
|
||||||
import "vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution";
|
|
||||||
|
|
||||||
// Outline
|
|
||||||
import "vs/workbench/parts/outline/electron-browser/outline.contribution";
|
|
||||||
|
|
||||||
// Experiments
|
|
||||||
import "vs/workbench/parts/experiments/electron-browser/experiments.contribution";
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
import { URI } from "vs/base/common/uri";
|
|
||||||
|
|
||||||
export {
|
|
||||||
URI,
|
|
||||||
startup,
|
|
||||||
};
|
|
204
packages/vscode/src/workbench.ts
Normal file
204
packages/vscode/src/workbench.ts
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
import * as os from "os";
|
||||||
|
import { IProgress, INotificationHandle } from "@coder/ide";
|
||||||
|
import { client } from "./client";
|
||||||
|
|
||||||
|
import "./fill/platform";
|
||||||
|
import "./fill/dom";
|
||||||
|
import "./fill/codeEditor";
|
||||||
|
import "./fill/environmentService";
|
||||||
|
import "./fill/labels";
|
||||||
|
import "./fill/menuRegistry";
|
||||||
|
import "./fill/mouseEvent";
|
||||||
|
import "./fill/storageDatabase";
|
||||||
|
import "./fill/vscodeTextmate";
|
||||||
|
import "./fill/windowsService";
|
||||||
|
import "./fill/workbenchRegistry";
|
||||||
|
import "./fill/workspacesService";
|
||||||
|
import * as paths from "./fill/paths";
|
||||||
|
import { PasteAction } from "./fill/paste";
|
||||||
|
|
||||||
|
import { ExplorerItem, ExplorerModel } from "vs/workbench/parts/files/common/explorerModel";
|
||||||
|
import { IEditorGroup } from "vs/workbench/services/group/common/editorGroupsService";
|
||||||
|
import { IEditorService, IResourceEditor } from "vs/workbench/services/editor/common/editorService";
|
||||||
|
import { INotificationService } from "vs/platform/notification/common/notification";
|
||||||
|
import { IProgressService2, ProgressLocation } from "vs/platform/progress/common/progress";
|
||||||
|
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces";
|
||||||
|
import { IWindowsService, IWindowConfiguration } from "vs/platform/windows/common/windows";
|
||||||
|
import { LogLevel } from "vs/platform/log/common/log";
|
||||||
|
import { RawContextKey, IContextKeyService } from "vs/platform/contextkey/common/contextkey";
|
||||||
|
import { ServiceCollection } from "vs/platform/instantiation/common/serviceCollection";
|
||||||
|
import { URI } from "vs/base/common/uri";
|
||||||
|
|
||||||
|
import "vs/loader";
|
||||||
|
|
||||||
|
export class Workbench {
|
||||||
|
private readonly windowId = parseInt(new Date().toISOString().replace(/[-:.TZ]/g, ""), 10);
|
||||||
|
private _serviceCollection: ServiceCollection | undefined;
|
||||||
|
private _clipboardContextKey: RawContextKey<boolean> | undefined;
|
||||||
|
|
||||||
|
public async handleExternalDrop(target: ExplorerItem | ExplorerModel, originalEvent: DragEvent): Promise<void> {
|
||||||
|
await client.upload.uploadDropped(
|
||||||
|
originalEvent,
|
||||||
|
(target instanceof ExplorerItem ? target : target.roots[0]).resource,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup, afterDrop: (targetGroup: IEditorGroup) => void, targetIndex?: number): void {
|
||||||
|
client.upload.uploadDropped(event, URI.file(paths.getWorkingDirectory())).then((paths) => {
|
||||||
|
const uris = paths.map((p) => URI.file(p));
|
||||||
|
if (uris.length) {
|
||||||
|
(this.serviceCollection.get(IWindowsService) as IWindowsService).addRecentlyOpened(uris);
|
||||||
|
}
|
||||||
|
|
||||||
|
const editors: IResourceEditor[] = uris.map(uri => ({
|
||||||
|
resource: uri,
|
||||||
|
options: {
|
||||||
|
pinned: true,
|
||||||
|
index: targetIndex,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const targetGroup = resolveTargetGroup();
|
||||||
|
|
||||||
|
(this.serviceCollection.get(IEditorService) as IEditorService).openEditors(editors, targetGroup).then(() => {
|
||||||
|
afterDrop(targetGroup);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to toggle the paste option inside editors based on the native clipboard.
|
||||||
|
*/
|
||||||
|
public get clipboardContextKey(): RawContextKey<boolean> {
|
||||||
|
if (!this._clipboardContextKey) {
|
||||||
|
throw new Error("Trying to access clipboard context key before it has been set");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._clipboardContextKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get clipboardText(): Promise<string> {
|
||||||
|
return client.clipboard.readText();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a paste action for use in text inputs.
|
||||||
|
*/
|
||||||
|
public get pasteAction(): PasteAction {
|
||||||
|
return new PasteAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public set workspace(ws: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | undefined) {
|
||||||
|
if (typeof ws === "undefined") {
|
||||||
|
window.localStorage.removeItem("workspace");
|
||||||
|
} else {
|
||||||
|
window.localStorage.setItem("workspace", JSON.stringify(ws));
|
||||||
|
}
|
||||||
|
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
public get workspace(): undefined | IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier {
|
||||||
|
const ws = window.localStorage.getItem("workspace");
|
||||||
|
try {
|
||||||
|
return JSON.parse(ws!);
|
||||||
|
} catch (ex) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public get serviceCollection(): ServiceCollection {
|
||||||
|
if (!this._serviceCollection) {
|
||||||
|
throw new Error("Trying to access service collection before it has been set");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._serviceCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set serviceCollection(collection: ServiceCollection) {
|
||||||
|
this._serviceCollection = collection;
|
||||||
|
client.progressService = {
|
||||||
|
start: <T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T> => {
|
||||||
|
let lastProgress = 0;
|
||||||
|
|
||||||
|
return (this.serviceCollection.get(IProgressService2) as IProgressService2).withProgress({
|
||||||
|
location: ProgressLocation.Notification,
|
||||||
|
title,
|
||||||
|
cancellable: true,
|
||||||
|
}, (progress) => {
|
||||||
|
return task({
|
||||||
|
report: (p): void => {
|
||||||
|
progress.report({ increment: p - lastProgress });
|
||||||
|
lastProgress = p;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, () => {
|
||||||
|
onCancel();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
client.notificationService = {
|
||||||
|
error: (error: Error): void => (this.serviceCollection.get(INotificationService) as INotificationService).error(error),
|
||||||
|
prompt: (severity, message, buttons, onCancel): INotificationHandle => {
|
||||||
|
const handle = (this.serviceCollection.get(INotificationService) as INotificationService).prompt(
|
||||||
|
severity, message, buttons, { onCancel },
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
close: (): void => handle.close(),
|
||||||
|
updateMessage: (message): void => handle.updateMessage(message),
|
||||||
|
updateButtons: (buttons): void => handle.updateActions({
|
||||||
|
primary: buttons.map((button) => ({
|
||||||
|
id: "",
|
||||||
|
label: button.label,
|
||||||
|
tooltip: "",
|
||||||
|
class: undefined,
|
||||||
|
enabled: true,
|
||||||
|
checked: false,
|
||||||
|
radio: false,
|
||||||
|
dispose: (): void => undefined,
|
||||||
|
run: (): Promise<void> => Promise.resolve(button.run()),
|
||||||
|
})),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async initialize(): Promise<void> {
|
||||||
|
this._clipboardContextKey = new RawContextKey("nativeClipboard", client.clipboard.isEnabled);
|
||||||
|
|
||||||
|
const workspace = this.workspace || URI.file(paths.getWorkingDirectory());
|
||||||
|
// If we try to import this above, workbench will be undefined due to
|
||||||
|
// circular imports.
|
||||||
|
require("vs/workbench/workbench.main");
|
||||||
|
const { startup } = require("vs/workbench/electron-browser/main");
|
||||||
|
const config: IWindowConfiguration = {
|
||||||
|
machineId: "1",
|
||||||
|
windowId: this.windowId,
|
||||||
|
logLevel: LogLevel.Info,
|
||||||
|
mainPid: 1,
|
||||||
|
appRoot: paths.getDefaultUserDataPath(),
|
||||||
|
execPath: os.tmpdir(),
|
||||||
|
userEnv: {},
|
||||||
|
nodeCachedDataDir: os.tmpdir(),
|
||||||
|
perfEntries: [],
|
||||||
|
_: [],
|
||||||
|
};
|
||||||
|
if ((workspace as IWorkspaceIdentifier).configPath) {
|
||||||
|
config.workspace = workspace as IWorkspaceIdentifier;
|
||||||
|
} else {
|
||||||
|
config.folderUri = workspace as URI;
|
||||||
|
}
|
||||||
|
await startup(config);
|
||||||
|
const contextKeys = this.serviceCollection.get(IContextKeyService) as IContextKeyService;
|
||||||
|
const bounded = this.clipboardContextKey.bindTo(contextKeys);
|
||||||
|
client.clipboard.onPermissionChange((enabled) => {
|
||||||
|
bounded.set(enabled);
|
||||||
|
});
|
||||||
|
client.clipboard.initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const workbench = new Workbench();
|
@ -1,3 +1,141 @@
|
|||||||
|
diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts
|
||||||
|
index 639ac3d031..85999db640 100644
|
||||||
|
--- a/src/vs/base/browser/browser.ts
|
||||||
|
+++ b/src/vs/base/browser/browser.ts
|
||||||
|
@@ -153,0 +154,4 @@ export const isEdgeWebView = isEdge && (userAgent.indexOf('WebView/') >= 0);
|
||||||
|
+export const isMacintosh = userAgent.indexOf("Macintosh") >= 0;
|
||||||
|
+export const isWindows = userAgent.indexOf("Windows") >= 0;
|
||||||
|
+export const isLinux = userAgent.indexOf("Linux") >= 0;
|
||||||
|
+
|
||||||
|
diff --git a/src/vs/base/browser/keyboardEvent.ts b/src/vs/base/browser/keyboardEvent.ts
|
||||||
|
index a6fdce5c7c..7a80c85398 100644
|
||||||
|
--- a/src/vs/base/browser/keyboardEvent.ts
|
||||||
|
+++ b/src/vs/base/browser/keyboardEvent.ts
|
||||||
|
@@ -154 +154 @@ let INVERSE_KEY_CODE_MAP: KeyCode[] = new Array(KeyCode.MAX_VALUE);
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
@@ -159 +159 @@ let INVERSE_KEY_CODE_MAP: KeyCode[] = new Array(KeyCode.MAX_VALUE);
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
@@ -202 +202 @@ export interface IKeyboardEvent {
|
||||||
|
-const ctrlKeyMod = (platform.isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd);
|
||||||
|
+const ctrlKeyMod = (browser.isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd);
|
||||||
|
@@ -205 +205 @@ const shiftKeyMod = KeyMod.Shift;
|
||||||
|
-const metaKeyMod = (platform.isMacintosh ? KeyMod.CtrlCmd : KeyMod.WinCtrl);
|
||||||
|
+const metaKeyMod = (browser.isMacintosh ? KeyMod.CtrlCmd : KeyMod.WinCtrl);
|
||||||
|
diff --git a/src/vs/base/browser/ui/aria/aria.ts b/src/vs/base/browser/ui/aria/aria.ts
|
||||||
|
index 1922450144..9900776aa2 100644
|
||||||
|
--- a/src/vs/base/browser/ui/aria/aria.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/aria/aria.ts
|
||||||
|
@@ -8 +8 @@ import * as nls from 'vs/nls';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts
|
||||||
|
index 5386958054..5c936e0a1d 100644
|
||||||
|
--- a/src/vs/base/browser/ui/list/listWidget.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/list/listWidget.ts
|
||||||
|
@@ -13 +13 @@ import * as DOM from 'vs/base/browser/dom';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -257 +257 @@ class KeyboardController<T> implements IDisposable {
|
||||||
|
- onKeyDown.filter(e => (platform.isMacintosh ? e.metaKey : e.ctrlKey) && e.keyCode === KeyCode.KEY_A).on(this.onCtrlA, this, this.disposables);
|
||||||
|
+ onKeyDown.filter(e => (browser.isMacintosh ? e.metaKey : e.ctrlKey) && e.keyCode === KeyCode.KEY_A).on(this.onCtrlA, this, this.disposables);
|
||||||
|
@@ -479 +479 @@ export function isSelectionSingleChangeEvent(event: IListMouseEvent<any> | IList
|
||||||
|
- return platform.isMacintosh ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
|
||||||
|
+ return browser.isMacintosh ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
|
||||||
|
@@ -539 +539 @@ class MouseController<T> implements IDisposable {
|
||||||
|
- return platform.isMacintosh ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
|
||||||
|
+ return browser.isMacintosh ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
|
||||||
|
diff --git a/src/vs/base/browser/ui/sash/sash.ts b/src/vs/base/browser/ui/sash/sash.ts
|
||||||
|
index 8c7168bad5..8bbea63b3b 100644
|
||||||
|
--- a/src/vs/base/browser/ui/sash/sash.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/sash/sash.ts
|
||||||
|
@@ -9 +9 @@ import { isIPad } from 'vs/base/browser/browser';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts
|
||||||
|
index 9b31c847f7..51de0eaf2f 100644
|
||||||
|
--- a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts
|
||||||
|
@@ -18 +18 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -269 +269 @@ export abstract class AbstractScrollableElement extends Widget {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
@@ -338 +338 @@ export abstract class AbstractScrollableElement extends Widget {
|
||||||
|
- const shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;
|
||||||
|
+ const shiftConvert = !browser.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;
|
||||||
|
@@ -571 +571 @@ function resolveOptions(opts: ScrollableElementCreationOptions): ScrollableEleme
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/base/browser/ui/selectBox/selectBox.ts b/src/vs/base/browser/ui/selectBox/selectBox.ts
|
||||||
|
index 0e7314fd28..814fb0abd8 100644
|
||||||
|
--- a/src/vs/base/browser/ui/selectBox/selectBox.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/selectBox/selectBox.ts
|
||||||
|
@@ -16 +16 @@ import { SelectBoxList } from 'vs/base/browser/ui/selectBox/selectBoxCustom';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts
|
||||||
|
index 77ca7e4f06..2dc4bf24f6 100644
|
||||||
|
--- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts
|
||||||
|
@@ -20 +20 @@ import { ISelectBoxDelegate, ISelectOptionItem, ISelectBoxOptions, ISelectBoxSty
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/base/browser/ui/selectBox/selectBoxNative.ts b/src/vs/base/browser/ui/selectBox/selectBoxNative.ts
|
||||||
|
index 01f59d40fa..453d5c4ed3 100644
|
||||||
|
--- a/src/vs/base/browser/ui/selectBox/selectBoxNative.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/selectBox/selectBoxNative.ts
|
||||||
|
@@ -12 +12 @@ import { ISelectBoxDelegate, ISelectOptionItem, ISelectBoxOptions, ISelectBoxSty
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts
|
||||||
|
index 742c6aa0d8..2791d0691e 100644
|
||||||
|
--- a/src/vs/base/browser/ui/tree/abstractTree.ts
|
||||||
|
+++ b/src/vs/base/browser/ui/tree/abstractTree.ts
|
||||||
|
@@ -24 +24 @@ import { disposableTimeout } from 'vs/base/common/async';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
|
||||||
|
index 65cdc14af5..f3567da05d 100644
|
||||||
|
--- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
|
||||||
|
+++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
|
||||||
|
@@ -8 +8 @@ import * as nls from 'vs/nls';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -66 +66 @@ export class QuickOpenController extends DefaultController {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/base/parts/tree/browser/treeDefaults.ts b/src/vs/base/parts/tree/browser/treeDefaults.ts
|
||||||
|
index 8d30a79e50..30cb97a224 100644
|
||||||
|
--- a/src/vs/base/parts/tree/browser/treeDefaults.ts
|
||||||
|
+++ b/src/vs/base/parts/tree/browser/treeDefaults.ts
|
||||||
|
@@ -8,0 +9 @@ import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -111 +112 @@ export class DefaultController implements _.IController {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
@@ -153 +154 @@ export class DefaultController implements _.IController {
|
||||||
|
- const isMac = platform.isMacintosh;
|
||||||
|
+ const isMac = browser.isMacintosh;
|
||||||
|
diff --git a/src/vs/code/electron-browser/issue/issueReporterMain.ts b/src/vs/code/electron-browser/issue/issueReporterMain.ts
|
||||||
|
index 169de560b5..1b79b77040 100644
|
||||||
|
--- a/src/vs/code/electron-browser/issue/issueReporterMain.ts
|
||||||
|
+++ b/src/vs/code/electron-browser/issue/issueReporterMain.ts
|
||||||
|
@@ -405 +405 @@ export class IssueReporter extends Disposable {
|
||||||
|
- const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||||
|
+ const cmdOrCtrlKey = browser.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||||
|
@@ -439 +439 @@ export class IssueReporter extends Disposable {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts b/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
|
||||||
|
index a9e8f38c81..0c305e4c1a 100644
|
||||||
|
--- a/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
|
||||||
|
+++ b/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
|
||||||
|
@@ -304 +304 @@ export function startup(data: ProcessExplorerData): void {
|
||||||
|
- const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||||
|
+ const cmdOrCtrlKey = browser.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||||
diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
||||||
index a342222d04..c731e82591 100644
|
index a342222d04..c731e82591 100644
|
||||||
--- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
--- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
||||||
@ -5,8 +143,68 @@ index a342222d04..c731e82591 100644
|
|||||||
@@ -195,0 +196,2 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
|
@@ -195,0 +196,2 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
|
||||||
+
|
+
|
||||||
+startup({ machineId: "1" });
|
+startup({ machineId: "1" });
|
||||||
|
diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts
|
||||||
|
index cfdce8929b..873476f3f1 100644
|
||||||
|
--- a/src/vs/editor/browser/config/configuration.ts
|
||||||
|
+++ b/src/vs/editor/browser/config/configuration.ts
|
||||||
|
@@ -352 +352 @@ export class Configuration extends CommonEditorConfiguration {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/editor/browser/controller/mouseHandler.ts b/src/vs/editor/browser/controller/mouseHandler.ts
|
||||||
|
index 1a8af35373..fe56af9340 100644
|
||||||
|
--- a/src/vs/editor/browser/controller/mouseHandler.ts
|
||||||
|
+++ b/src/vs/editor/browser/controller/mouseHandler.ts
|
||||||
|
@@ -222 +222 @@ export class MouseHandler extends ViewEventHandler {
|
||||||
|
- if (platform.isMacintosh && e.leftButton && e.ctrlKey) {
|
||||||
|
+ if (browser.isMacintosh && e.leftButton && e.ctrlKey) {
|
||||||
|
diff --git a/src/vs/editor/browser/controller/textAreaHandler.ts b/src/vs/editor/browser/controller/textAreaHandler.ts
|
||||||
|
index df30bd1a03..536edba762 100644
|
||||||
|
--- a/src/vs/editor/browser/controller/textAreaHandler.ts
|
||||||
|
+++ b/src/vs/editor/browser/controller/textAreaHandler.ts
|
||||||
|
@@ -213 +213 @@ export class TextAreaHandler extends ViewPart {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts
|
||||||
|
index 7ccf0e99d2..8c30ca2df0 100644
|
||||||
|
--- a/src/vs/editor/browser/controller/textAreaInput.ts
|
||||||
|
+++ b/src/vs/editor/browser/controller/textAreaInput.ts
|
||||||
|
@@ -262 +262 @@ export class TextAreaInput extends Disposable {
|
||||||
|
- const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/platform.isMacintosh, /*couldBeTypingAtOffset0*/previousEventWasFocus && platform.isMacintosh);
|
||||||
|
+ const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/browser.isMacintosh, /*couldBeTypingAtOffset0*/previousEventWasFocus && browser.isMacintosh);
|
||||||
|
diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts
|
||||||
|
index b88b781dbb..af9b3ed23a 100644
|
||||||
|
--- a/src/vs/editor/common/config/commonEditorConfig.ts
|
||||||
|
+++ b/src/vs/editor/common/config/commonEditorConfig.ts
|
||||||
|
@@ -372 +372 @@ const editorConfiguration: IConfigurationNode = {
|
||||||
|
- 'included': platform.isMacintosh
|
||||||
|
+ 'included': false && platform.isMacintosh
|
||||||
|
diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts
|
||||||
|
index d8ee1d9226..8f8bd8fe90 100644
|
||||||
|
--- a/src/vs/editor/common/config/editorOptions.ts
|
||||||
|
+++ b/src/vs/editor/common/config/editorOptions.ts
|
||||||
|
@@ -9,0 +10 @@ import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -1751 +1752 @@ export class EditorOptionsValidator {
|
||||||
|
- configuredMulticursorModifier = platform.isMacintosh ? 'metaKey' : 'ctrlKey';
|
||||||
|
+ configuredMulticursorModifier = browser.isMacintosh ? 'metaKey' : 'ctrlKey';
|
||||||
|
@@ -2513 +2514 @@ export const EDITOR_FONT_DEFAULTS = {
|
||||||
|
- platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
|
||||||
|
+ browser.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
|
||||||
|
@@ -2517 +2518 @@ export const EDITOR_FONT_DEFAULTS = {
|
||||||
|
- platform.isMacintosh ? 12 : 14
|
||||||
|
+ browser.isMacintosh ? 12 : 14
|
||||||
|
diff --git a/src/vs/editor/common/config/fontInfo.ts b/src/vs/editor/common/config/fontInfo.ts
|
||||||
|
index 88cb52aa90..c4a1be9c98 100644
|
||||||
|
--- a/src/vs/editor/common/config/fontInfo.ts
|
||||||
|
+++ b/src/vs/editor/common/config/fontInfo.ts
|
||||||
|
@@ -6 +6 @@
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -14 +14 @@ import { EditorZoom } from 'vs/editor/common/config/editorZoom';
|
||||||
|
-const GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35;
|
||||||
|
+const GOLDEN_LINE_HEIGHT_RATIO = browser.isMacintosh ? 1.5 : 1.35;
|
||||||
diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts
|
diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts
|
||||||
index 5e43f1b39e..a008d3ac7e 100644
|
index 5e43f1b39e..2244391563 100644
|
||||||
--- a/src/vs/editor/contrib/clipboard/clipboard.ts
|
--- a/src/vs/editor/contrib/clipboard/clipboard.ts
|
||||||
+++ b/src/vs/editor/contrib/clipboard/clipboard.ts
|
+++ b/src/vs/editor/contrib/clipboard/clipboard.ts
|
||||||
@@ -29 +29,2 @@ const supportsCopyWithSyntaxHighlighting = (supportsCopy && !browser.isEdgeOrIE)
|
@@ -29 +29,2 @@ const supportsCopyWithSyntaxHighlighting = (supportsCopy && !browser.isEdgeOrIE)
|
||||||
@ -14,21 +212,21 @@ index 5e43f1b39e..a008d3ac7e 100644
|
|||||||
+// const supportsPaste = (platform.isNative || (!browser.isChrome && document.queryCommandSupported('paste')));
|
+// const supportsPaste = (platform.isNative || (!browser.isChrome && document.queryCommandSupported('paste')));
|
||||||
+const supportsPaste = true;
|
+const supportsPaste = true;
|
||||||
@@ -176,0 +178 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
@@ -176,0 +178 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
||||||
+ const { client } = require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode');
|
+ const { workbench } = require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench');
|
||||||
@@ -181 +183 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
@@ -181 +183 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
||||||
- precondition: EditorContextKeys.writable,
|
- precondition: EditorContextKeys.writable,
|
||||||
+ precondition: (require('vs/platform/contextkey/common/contextkey') as typeof import('vs/platform/contextkey/common/contextkey')).ContextKeyExpr.and(EditorContextKeys.writable, client.clipboardContextKey),
|
+ precondition: (require('vs/platform/contextkey/common/contextkey') as typeof import('vs/platform/contextkey/common/contextkey')).ContextKeyExpr.and(EditorContextKeys.writable, workbench.clipboardContextKey),
|
||||||
@@ -191 +193,2 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
@@ -191 +193,2 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
||||||
- order: 3
|
- order: 3
|
||||||
+ order: 3,
|
+ order: 3,
|
||||||
+ when: client.clipboardContextKey,
|
+ when: workbench.clipboardContextKey,
|
||||||
@@ -194,0 +198,14 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
@@ -194,0 +198,14 @@ class ExecCommandPasteAction extends ExecCommandAction {
|
||||||
+
|
+
|
||||||
+ public async run(accessor, editor: ICodeEditor): Promise<void> {
|
+ public async run(accessor, editor: ICodeEditor): Promise<void> {
|
||||||
+ if (editor instanceof (require('vs/editor/browser/widget/codeEditorWidget') as typeof import('vs/editor/browser/widget/codeEditorWidget')).CodeEditorWidget) {
|
+ if (editor instanceof (require('vs/editor/browser/widget/codeEditorWidget') as typeof import('vs/editor/browser/widget/codeEditorWidget')).CodeEditorWidget) {
|
||||||
+ try {
|
+ try {
|
||||||
+ editor.trigger('', (require('vs/editor/common/editorCommon') as typeof import ('vs/editor/common/editorCommon')).Handler.Paste, {
|
+ 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,
|
+ text: await (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.clipboardText,
|
||||||
+ });
|
+ });
|
||||||
+ } catch (ex) {
|
+ } catch (ex) {
|
||||||
+ super.run(accessor, editor);
|
+ super.run(accessor, editor);
|
||||||
@ -37,6 +235,52 @@ index 5e43f1b39e..a008d3ac7e 100644
|
|||||||
+ super.run(accessor, editor);
|
+ super.run(accessor, editor);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
diff --git a/src/vs/editor/contrib/dnd/dnd.ts b/src/vs/editor/contrib/dnd/dnd.ts
|
||||||
|
index caa3ea75fd..e32371f932 100644
|
||||||
|
--- a/src/vs/editor/contrib/dnd/dnd.ts
|
||||||
|
+++ b/src/vs/editor/contrib/dnd/dnd.ts
|
||||||
|
@@ -9 +9 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts b/src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts
|
||||||
|
index 3b72a01a35..0d723f5800 100644
|
||||||
|
--- a/src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts
|
||||||
|
+++ b/src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts
|
||||||
|
@@ -86 +86 @@ function createOptions(multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey'): C
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
@@ -92 +92 @@ function createOptions(multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey'): C
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/editor/contrib/links/links.ts b/src/vs/editor/contrib/links/links.ts
|
||||||
|
index d224f2254a..4baf574025 100644
|
||||||
|
--- a/src/vs/editor/contrib/links/links.ts
|
||||||
|
+++ b/src/vs/editor/contrib/links/links.ts
|
||||||
|
@@ -13 +13 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -29 +29 @@ const HOVER_MESSAGE_GENERAL_META = new MarkdownString().appendText(
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
@@ -35 +35 @@ const HOVER_MESSAGE_COMMAND_META = new MarkdownString().appendText(
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
@@ -41 +41 @@ const HOVER_MESSAGE_GENERAL_ALT = new MarkdownString().appendText(
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
@@ -47 +47 @@ const HOVER_MESSAGE_COMMAND_ALT = new MarkdownString().appendText(
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
|
||||||
|
index 605c1209e1..e8131513de 100644
|
||||||
|
--- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
|
||||||
|
+++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
|
||||||
|
@@ -261 +261 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
@@ -290 +290 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
diff --git a/src/vs/loader.js b/src/vs/loader.js
|
diff --git a/src/vs/loader.js b/src/vs/loader.js
|
||||||
index 4eddcab3a0..5d80768406 100644
|
index 4eddcab3a0..5d80768406 100644
|
||||||
--- a/src/vs/loader.js
|
--- a/src/vs/loader.js
|
||||||
@ -61,6 +305,36 @@ index 4eddcab3a0..5d80768406 100644
|
|||||||
@@ -741 +748 @@ var AMDLoader;
|
@@ -741 +748 @@ var AMDLoader;
|
||||||
- moduleExports_1 = nodeRequire(pieces[1]);
|
- moduleExports_1 = nodeRequire(pieces[1]);
|
||||||
+ moduleExports_1 = context(pieces[1]);
|
+ moduleExports_1 = context(pieces[1]);
|
||||||
|
diff --git a/src/vs/platform/clipboard/electron-browser/clipboardService.ts b/src/vs/platform/clipboard/electron-browser/clipboardService.ts
|
||||||
|
index 667b47218a..36dd5ddd3e 100644
|
||||||
|
--- a/src/vs/platform/clipboard/electron-browser/clipboardService.ts
|
||||||
|
+++ b/src/vs/platform/clipboard/electron-browser/clipboardService.ts
|
||||||
|
@@ -9 +9 @@ import { URI } from 'vs/base/common/uri';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/platform/launch/electron-main/launchService.ts b/src/vs/platform/launch/electron-main/launchService.ts
|
||||||
|
index ba14b19533..d1590f50ef 100644
|
||||||
|
--- a/src/vs/platform/launch/electron-main/launchService.ts
|
||||||
|
+++ b/src/vs/platform/launch/electron-main/launchService.ts
|
||||||
|
@@ -9 +9,2 @@ import { IURLService } from 'vs/platform/url/common/url';
|
||||||
|
-import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts
|
||||||
|
index 56eaeef6f4..ec8a6e5960 100644
|
||||||
|
--- a/src/vs/platform/windows/common/windows.ts
|
||||||
|
+++ b/src/vs/platform/windows/common/windows.ts
|
||||||
|
@@ -9 +9,2 @@ import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||||
|
-import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/platform/workbench/common/contextkeys.ts b/src/vs/platform/workbench/common/contextkeys.ts
|
||||||
|
index 94b03a0ce9..c3608a2763 100644
|
||||||
|
--- a/src/vs/platform/workbench/common/contextkeys.ts
|
||||||
|
+++ b/src/vs/platform/workbench/common/contextkeys.ts
|
||||||
|
@@ -7 +7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
|
-import { isMacintosh, isLinux, isWindows } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh, isLinux, isWindows } from 'vs/base/browser/browser';
|
||||||
diff --git a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
|
diff --git a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts b/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
|
||||||
index 6c52cbc937..09adbe7f51 100644
|
index 6c52cbc937..09adbe7f51 100644
|
||||||
--- a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
|
--- a/src/vs/workbench/api/electron-browser/mainThreadHeapService.ts
|
||||||
@ -77,12 +351,143 @@ index 1f4a1e100b..1bf605a064 100644
|
|||||||
- r = require.__$__nodeRequire<T>(modulePath);
|
- r = require.__$__nodeRequire<T>(modulePath);
|
||||||
+ r = (global as any).nativeNodeRequire(modulePath);
|
+ r = (global as any).nativeNodeRequire(modulePath);
|
||||||
diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts
|
diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts
|
||||||
index e73acff052..bd65fcbd6c 100644
|
index e73acff052..c52bb3c7a2 100644
|
||||||
--- a/src/vs/workbench/browser/dnd.ts
|
--- a/src/vs/workbench/browser/dnd.ts
|
||||||
+++ b/src/vs/workbench/browser/dnd.ts
|
+++ b/src/vs/workbench/browser/dnd.ts
|
||||||
@@ -171 +171 @@ export class ResourcesDropHandler {
|
@@ -171 +171 @@ export class ResourcesDropHandler {
|
||||||
- return;
|
- return;
|
||||||
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex);
|
+ return (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex);
|
||||||
|
diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts
|
||||||
|
index 7213400c86..a54def1640 100644
|
||||||
|
--- a/src/vs/workbench/browser/layout.ts
|
||||||
|
+++ b/src/vs/workbench/browser/layout.ts
|
||||||
|
@@ -29 +29 @@ import { getZoomFactor } from 'vs/base/browser/browser';
|
||||||
|
-const TITLE_BAR_HEIGHT = isMacintosh ? 22 : 30;
|
||||||
|
+const TITLE_BAR_HEIGHT = /* isMacintosh ? 22 : */30;
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts
|
||||||
|
index b262c8aeef..4e23df1bc6 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts
|
||||||
|
@@ -48 +48 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts
|
||||||
|
index 9eca348265..df1d84514f 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts
|
||||||
|
@@ -14 +14 @@ import { IEditorIdentifier, EditorInput, EditorOptions } from 'vs/workbench/comm
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/editor/resourceViewer.ts b/src/vs/workbench/browser/parts/editor/resourceViewer.ts
|
||||||
|
index a0cc90b573..781e0187a0 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/editor/resourceViewer.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/editor/resourceViewer.ts
|
||||||
|
@@ -23 +23 @@ import { memoize } from 'vs/base/common/decorators';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -444 +444 @@ class InlineImageView {
|
||||||
|
- if (platform.isMacintosh ? altPressed : ctrlPressed) {
|
||||||
|
+ if (browser.isMacintosh ? altPressed : ctrlPressed) {
|
||||||
|
@@ -458 +458 @@ class InlineImageView {
|
||||||
|
- if (!(platform.isMacintosh ? altPressed : ctrlPressed)) {
|
||||||
|
+ if (!(browser.isMacintosh ? altPressed : ctrlPressed)) {
|
||||||
|
@@ -478 +478 @@ class InlineImageView {
|
||||||
|
- if (!(platform.isMacintosh ? altPressed : ctrlPressed)) { // zoom in
|
||||||
|
+ if (!(browser.isMacintosh ? altPressed : ctrlPressed)) { // zoom in
|
||||||
|
@@ -502 +502 @@ class InlineImageView {
|
||||||
|
- const isScrollWhellKeyPressed = platform.isMacintosh ? altPressed : ctrlPressed;
|
||||||
|
+ const isScrollWhellKeyPressed = browser.isMacintosh ? altPressed : ctrlPressed;
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
|
||||||
|
index 5f957c221a..f29d27759e 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
|
||||||
|
@@ -7 +7 @@ import 'vs/css!./media/tabstitlecontrol';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputList.ts b/src/vs/workbench/browser/parts/quickinput/quickInputList.ts
|
||||||
|
index f24bb0bcc0..219a1dcae5 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/quickinput/quickInputList.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/quickinput/quickInputList.ts
|
||||||
|
@@ -24 +24 @@ import { range } from 'vs/base/common/arrays';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -263 +263 @@ export class QuickInputList {
|
||||||
|
- if (platform.isMacintosh ? e.metaKey : e.ctrlKey) {
|
||||||
|
+ if (browser.isMacintosh ? e.metaKey : e.ctrlKey) {
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css
|
||||||
|
index 38794f793d..d4daa083bd 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css
|
||||||
|
+++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css
|
||||||
|
@@ -44,0 +45 @@
|
||||||
|
+.web > .monaco-workbench .part.titlebar,
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts
|
||||||
|
index 121bf09bb8..f5d425300a 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts
|
||||||
|
@@ -16 +16,2 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||||
|
-import { isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||||
|
+import { isNative } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh, isLinux } from 'vs/base/browser/browser';
|
||||||
|
@@ -113 +114 @@ export class MenubarControl extends Disposable {
|
||||||
|
- if (isMacintosh) {
|
||||||
|
+ if (isNative && isMacintosh) {
|
||||||
|
@@ -119 +120 @@ export class MenubarControl extends Disposable {
|
||||||
|
- if (isMacintosh || this.currentTitlebarStyleSetting !== 'custom') {
|
||||||
|
+ if ((isNative && isMacintosh) || this.currentTitlebarStyleSetting !== 'custom') {
|
||||||
|
@@ -255 +256 @@ export class MenubarControl extends Disposable {
|
||||||
|
- if (!isMacintosh && this.currentTitlebarStyleSetting === 'custom') {
|
||||||
|
+ if (!(isNative && isMacintosh) && this.currentTitlebarStyleSetting === 'custom') {
|
||||||
|
@@ -271 +272 @@ export class MenubarControl extends Disposable {
|
||||||
|
- if (!isMacintosh && this.currentTitlebarStyleSetting === 'custom') {
|
||||||
|
+ if (!(isNative && isMacintosh) && this.currentTitlebarStyleSetting === 'custom') {
|
||||||
|
@@ -432 +433 @@ export class MenubarControl extends Disposable {
|
||||||
|
- if (!isMacintosh) {
|
||||||
|
+ if (!(isNative && isMacintosh)) {
|
||||||
|
@@ -648 +649 @@ export class MenubarControl extends Disposable {
|
||||||
|
- if (!isMacintosh && this.currentTitlebarStyleSetting === 'custom') {
|
||||||
|
+ if (!(isNative && isMacintosh) && this.currentTitlebarStyleSetting === 'custom') {
|
||||||
|
diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
|
||||||
|
index 4b3eb7bdb8..9161baf086 100644
|
||||||
|
--- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
|
||||||
|
+++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
|
||||||
|
@@ -25 +25,2 @@ import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INA
|
||||||
|
-import { isMacintosh, isWindows, isLinux } from 'vs/base/common/platform';
|
||||||
|
+import { isNative } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh, isWindows, isLinux } from 'vs/base/browser/browser';
|
||||||
|
@@ -320 +321 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi
|
||||||
|
- if (!isMacintosh) {
|
||||||
|
+ if (!(isNative && isMacintosh)) {
|
||||||
|
@@ -336 +337 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi
|
||||||
|
- if (!isMacintosh) {
|
||||||
|
+ if (!(isNative && isMacintosh)) {
|
||||||
|
@@ -543 +544 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi
|
||||||
|
- if (!isMacintosh &&
|
||||||
|
+ if (!(isNative && isMacintosh) &&
|
||||||
|
@@ -559 +560 @@ export class TitlebarPart extends Part implements ITitleService, ISerializableVi
|
||||||
|
- if (isMacintosh || this.configurationService.getValue<MenuBarVisibility>('window.menuBarVisibility') === 'hidden') {
|
||||||
|
+ if ((isNative && isMacintosh) || this.configurationService.getValue<MenuBarVisibility>('window.menuBarVisibility') === 'hidden') {
|
||||||
|
diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts
|
||||||
|
index 3798dbde4f..b0a5c23521 100644
|
||||||
|
--- a/src/vs/workbench/browser/workbench.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/browser/workbench.contribution.ts
|
||||||
|
@@ -9 +9 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/electron-browser/actions/helpActions.ts b/src/vs/workbench/electron-browser/actions/helpActions.ts
|
||||||
|
index 85d39d64d7..4b958dc79f 100644
|
||||||
|
--- a/src/vs/workbench/electron-browser/actions/helpActions.ts
|
||||||
|
+++ b/src/vs/workbench/electron-browser/actions/helpActions.ts
|
||||||
|
@@ -9 +9,2 @@ import product from 'vs/platform/node/product';
|
||||||
|
-import { isMacintosh, isLinux, language } from 'vs/base/common/platform';
|
||||||
|
+import { language } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh, isLinux } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/electron-browser/actions/windowActions.ts b/src/vs/workbench/electron-browser/actions/windowActions.ts
|
||||||
|
index 0cf3ec6611..b8b61194ba 100644
|
||||||
|
--- a/src/vs/workbench/electron-browser/actions/windowActions.ts
|
||||||
|
+++ b/src/vs/workbench/electron-browser/actions/windowActions.ts
|
||||||
|
@@ -14 +14 @@ import { IWorkspaceConfigurationService } from 'vs/workbench/services/configurat
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts
|
diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts
|
||||||
index 1e6333c731..0a7bdeeb9b 100644
|
index 1e6333c731..0a7bdeeb9b 100644
|
||||||
--- a/src/vs/workbench/electron-browser/main.ts
|
--- a/src/vs/workbench/electron-browser/main.ts
|
||||||
@ -102,22 +507,155 @@ index 1e6333c731..0a7bdeeb9b 100644
|
|||||||
+ // }
|
+ // }
|
||||||
+ // }
|
+ // }
|
||||||
+ // });
|
+ // });
|
||||||
|
diff --git a/src/vs/workbench/electron-browser/shell.contribution.ts b/src/vs/workbench/electron-browser/shell.contribution.ts
|
||||||
|
index bc02c150a7..4ef622f669 100644
|
||||||
|
--- a/src/vs/workbench/electron-browser/shell.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/electron-browser/shell.contribution.ts
|
||||||
|
@@ -14 +14,2 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
|
||||||
|
-import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isNative, isWeb } from 'vs/base/common/platform';
|
||||||
|
+import { isWindows, isLinux, isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
@@ -488 +489 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- isMacintosh ?
|
||||||
|
+ isNative && isMacintosh ?
|
||||||
|
@@ -495 +496 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- isMacintosh ?
|
||||||
|
+ isNative && isMacintosh ?
|
||||||
|
@@ -582 +583 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- 'included': isWindows || isLinux
|
||||||
|
+ 'included': isWeb || isWindows || isLinux
|
||||||
|
@@ -589 +590 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- 'included': isWindows || isLinux
|
||||||
|
+ 'included': isWeb || isWindows || isLinux
|
||||||
|
@@ -615 +616 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- 'included': isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
|
||||||
|
+ 'included': isNative && isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
|
||||||
|
@@ -621 +622 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- 'included': isMacintosh
|
||||||
|
+ 'included': isNative && isMacintosh
|
||||||
|
@@ -632 +632,0 @@ configurationRegistry.registerConfiguration({
|
||||||
|
-
|
||||||
|
diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts
|
||||||
|
index fd95939506..5ed6fb52b2 100644
|
||||||
|
--- a/src/vs/workbench/electron-browser/shell.ts
|
||||||
|
+++ b/src/vs/workbench/electron-browser/shell.ts
|
||||||
|
@@ -548 +548 @@ export class Shell extends Disposable {
|
||||||
|
- addClasses(this.container, 'monaco-shell', platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac');
|
||||||
|
+ addClasses(this.container, 'web monaco-shell', platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac');
|
||||||
diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts
|
diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts
|
||||||
index c0aff6bd4b..4f3b1e3984 100644
|
index c0aff6bd4b..15af61a9ec 100644
|
||||||
--- a/src/vs/workbench/electron-browser/window.ts
|
--- a/src/vs/workbench/electron-browser/window.ts
|
||||||
+++ b/src/vs/workbench/electron-browser/window.ts
|
+++ b/src/vs/workbench/electron-browser/window.ts
|
||||||
@@ -49 +49 @@ const TextInputActions: IAction[] = [
|
@@ -49 +49 @@ const TextInputActions: IAction[] = [
|
||||||
- new Action('editor.action.clipboardPasteAction', nls.localize('paste', "Paste"), undefined, true, () => Promise.resolve(document.execCommand('paste'))),
|
- new Action('editor.action.clipboardPasteAction', nls.localize('paste', "Paste"), undefined, true, () => Promise.resolve(document.execCommand('paste'))),
|
||||||
+ (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.pasteAction,
|
+ (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.pasteAction,
|
||||||
@@ -263 +263 @@ export class ElectronWindow extends Themable {
|
@@ -263 +263 @@ export class ElectronWindow extends Themable {
|
||||||
- (<any>window).open = function (url: string, target: string, features: string, replace: boolean): any {
|
- (<any>window).open = function (url: string, target: string, features: string, replace: boolean): any {
|
||||||
+ (<any>window).openInvalid = function (url: string, target: string, features: string, replace: boolean): any {
|
+ (<any>window).openInvalid = function (url: string, target: string, features: string, replace: boolean): any {
|
||||||
|
@@ -304 +304 @@ export class ElectronWindow extends Themable {
|
||||||
|
- !isMacintosh || // macOS only
|
||||||
|
+ !browser.isMacintosh || // macOS only
|
||||||
diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts
|
diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts
|
||||||
index d82db96296..c9bd4e0325 100644
|
index d82db96296..ceabf4f791 100644
|
||||||
--- a/src/vs/workbench/electron-browser/workbench.ts
|
--- a/src/vs/workbench/electron-browser/workbench.ts
|
||||||
+++ b/src/vs/workbench/electron-browser/workbench.ts
|
+++ b/src/vs/workbench/electron-browser/workbench.ts
|
||||||
@@ -272,0 +273 @@ export class Workbench extends Disposable implements IPartService {
|
@@ -19 +19,2 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||||
+ (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.serviceCollection = serviceCollection;
|
-import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isWeb, isNative } from 'vs/base/common/platform';
|
||||||
|
+import { isWindows, isLinux, isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
@@ -272,0 +274 @@ export class Workbench extends Disposable implements IPartService {
|
||||||
|
+ (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.serviceCollection = serviceCollection;
|
||||||
|
@@ -380 +382 @@ export class Workbench extends Disposable implements IPartService {
|
||||||
|
- if (!isMacintosh && this.useCustomTitleBarStyle()) {
|
||||||
|
+ if (isWeb || (!isMacintosh && this.useCustomTitleBarStyle())) {
|
||||||
|
@@ -1098 +1100 @@ export class Workbench extends Disposable implements IPartService {
|
||||||
|
- if ((isWindows || isLinux) && this.useCustomTitleBarStyle()) {
|
||||||
|
+ if ((isWeb || isWindows || isLinux) && this.useCustomTitleBarStyle()) {
|
||||||
|
@@ -1265 +1267 @@ export class Workbench extends Disposable implements IPartService {
|
||||||
|
- } else if (isMacintosh) {
|
||||||
|
+ } else if (isNative && isMacintosh) {
|
||||||
|
diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts
|
||||||
|
index 265a7bc474..8eef7e5d10 100644
|
||||||
|
--- a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts
|
||||||
|
+++ b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts
|
||||||
|
@@ -15,0 +16 @@ import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -196 +197 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
@@ -238 +239 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/suggestEnabledInput.ts b/src/vs/workbench/parts/codeEditor/electron-browser/suggestEnabledInput.ts
|
||||||
|
index 8c692b4fcc..ce990c83d6 100644
|
||||||
|
--- a/src/vs/workbench/parts/codeEditor/electron-browser/suggestEnabledInput.ts
|
||||||
|
+++ b/src/vs/workbench/parts/codeEditor/electron-browser/suggestEnabledInput.ts
|
||||||
|
@@ -14 +14 @@ import { mixin } from 'vs/base/common/objects';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts
|
||||||
|
index 5e1b6da216..f8643d2e18 100644
|
||||||
|
--- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts
|
||||||
|
+++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts
|
||||||
|
@@ -8 +8 @@ import { Action } from 'vs/base/common/actions';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -84 +84 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSelectionMenu, {
|
||||||
|
- platform.isMacintosh
|
||||||
|
+ browser.isMacintosh
|
||||||
|
diff --git a/src/vs/workbench/parts/comments/electron-browser/commentNode.ts b/src/vs/workbench/parts/comments/electron-browser/commentNode.ts
|
||||||
|
index 5d1c0b3b43..dc4ed358c1 100644
|
||||||
|
--- a/src/vs/workbench/parts/comments/electron-browser/commentNode.ts
|
||||||
|
+++ b/src/vs/workbench/parts/comments/electron-browser/commentNode.ts
|
||||||
|
@@ -26 +26 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
|
||||||
|
index c5eea6a8d0..72f8329f2f 100644
|
||||||
|
--- a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
|
||||||
|
+++ b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
|
||||||
|
@@ -15 +15 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -636 +636 @@ export class ReviewZoneWidget extends ZoneWidget {
|
||||||
|
- let keybinding = platform.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter';
|
||||||
|
+ let keybinding = browser.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter';
|
||||||
|
diff --git a/src/vs/workbench/parts/debug/browser/linkDetector.ts b/src/vs/workbench/parts/debug/browser/linkDetector.ts
|
||||||
|
index 49bb7903ac..624d03d56e 100644
|
||||||
|
--- a/src/vs/workbench/parts/debug/browser/linkDetector.ts
|
||||||
|
+++ b/src/vs/workbench/parts/debug/browser/linkDetector.ts
|
||||||
|
@@ -9 +9 @@ import { URI as uri } from 'vs/base/common/uri';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts
|
||||||
|
index 2d640f1a84..cbc7353a20 100644
|
||||||
|
--- a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts
|
||||||
|
@@ -45 +45 @@ import { ViewsRegistry } from 'vs/workbench/common/views';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts b/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts
|
||||||
|
index f6350174f3..5a884fc81b 100644
|
||||||
|
--- a/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts
|
||||||
|
@@ -9,0 +10 @@ import * as env from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -180 +181 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||||
|
- if (e.event.rightButton || (env.isMacintosh && e.event.leftButton && e.event.ctrlKey)) {
|
||||||
|
+ if (e.event.rightButton || (browser.isMacintosh && e.event.leftButton && e.event.ctrlKey)) {
|
||||||
|
@@ -429 +430 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||||
|
- const stopKey = env.isMacintosh ? 'metaKey' : 'ctrlKey';
|
||||||
|
+ const stopKey = browser.isMacintosh ? 'metaKey' : 'ctrlKey';
|
||||||
|
@@ -447 +448 @@ export class DebugEditorContribution implements IDebugEditorContribution {
|
||||||
|
- const stopKey = env.isMacintosh ? KeyCode.Meta : KeyCode.Ctrl;
|
||||||
|
+ const stopKey = browser.isMacintosh ? KeyCode.Meta : KeyCode.Ctrl;
|
||||||
|
diff --git a/src/vs/workbench/parts/debug/electron-browser/repl.ts b/src/vs/workbench/parts/debug/electron-browser/repl.ts
|
||||||
|
index 21b493db79..b608d21912 100644
|
||||||
|
--- a/src/vs/workbench/parts/debug/electron-browser/repl.ts
|
||||||
|
+++ b/src/vs/workbench/parts/debug/electron-browser/repl.ts
|
||||||
|
@@ -13 +13 @@ import * as aria from 'vs/base/browser/ui/aria/aria';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts
|
diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts
|
||||||
index 81954344b9..2bdce9603e 100644
|
index 81954344b9..2bdce9603e 100644
|
||||||
--- a/src/vs/workbench/parts/debug/node/debugAdapter.ts
|
--- a/src/vs/workbench/parts/debug/node/debugAdapter.ts
|
||||||
@ -128,12 +666,29 @@ index 81954344b9..2bdce9603e 100644
|
|||||||
@@ -320 +320 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
@@ -320 +320 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
||||||
- if (!fs.existsSync(this.adapterExecutable.command)) {
|
- if (!fs.existsSync(this.adapterExecutable.command)) {
|
||||||
+ if (!(await require("util").promisify(fs.exists)(this.adapterExecutable.command))) {
|
+ if (!(await require("util").promisify(fs.exists)(this.adapterExecutable.command))) {
|
||||||
|
diff --git a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts
|
||||||
|
index 1002950c75..8c187d36ff 100644
|
||||||
|
--- a/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts
|
||||||
|
@@ -17 +17 @@ import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/co
|
||||||
|
-import { isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isWindows, isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
diff --git a/src/vs/workbench/parts/files/electron-browser/fileCommands.ts b/src/vs/workbench/parts/files/electron-browser/fileCommands.ts
|
||||||
|
index 0bd9b93fcc..1c8adeb5ca 100644
|
||||||
|
--- a/src/vs/workbench/parts/files/electron-browser/fileCommands.ts
|
||||||
|
+++ b/src/vs/workbench/parts/files/electron-browser/fileCommands.ts
|
||||||
|
@@ -29 +29 @@ import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes';
|
||||||
|
-import { isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isWindows, isMacintosh } from 'vs/base/browser/browser';
|
||||||
diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
|
diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
|
||||||
index e66f74f034..759ffe0cef 100644
|
index e66f74f034..e2c24d851a 100644
|
||||||
--- a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
|
--- a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
|
||||||
+++ b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
|
+++ b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
|
||||||
|
@@ -39 +39 @@ import { DesktopDragAndDropData, ExternalElementsDragAndDropData, ElementsDragAn
|
||||||
|
-import { isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh, isLinux } from 'vs/base/browser/browser';
|
||||||
@@ -586,0 +587 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
|
@@ -586,0 +587 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
|
||||||
+ return (require('vs/../../../../packages/vscode') as typeof import('vs/../../../../packages/vscode')).client.handleExternalDrop(target, originalEvent);
|
+ return (require('vs/../../../../packages/vscode/src/workbench') as typeof import('vs/../../../../packages/vscode/src/workbench')).workbench.handleExternalDrop(target, originalEvent);
|
||||||
diff --git a/src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts b/src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts
|
diff --git a/src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts b/src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts
|
||||||
index 4015c9cd5d..bebdb25f6c 100644
|
index 4015c9cd5d..bebdb25f6c 100644
|
||||||
--- a/src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts
|
--- a/src/vs/workbench/parts/logs/electron-browser/logs.contribution.ts
|
||||||
@ -143,12 +698,89 @@ index 4015c9cd5d..bebdb25f6c 100644
|
|||||||
+ // This channel only seems to be used when loading the app and we skip all of that, so it is never actually created or written to.
|
+ // This channel only seems to be used when loading the app and we skip all of that, so it is never actually created or written to.
|
||||||
+ // outputChannelRegistry.registerChannel({ id: Constants.mainLogChannelId, label: nls.localize('mainLog', "Main"), file: URI.file(join(environmentService.logsPath, `main.log`)), log: true });
|
+ // outputChannelRegistry.registerChannel({ id: Constants.mainLogChannelId, label: nls.localize('mainLog', "Main"), file: URI.file(join(environmentService.logsPath, `main.log`)), log: true });
|
||||||
diff --git a/src/vs/workbench/parts/output/common/outputLinkProvider.ts b/src/vs/workbench/parts/output/common/outputLinkProvider.ts
|
diff --git a/src/vs/workbench/parts/output/common/outputLinkProvider.ts b/src/vs/workbench/parts/output/common/outputLinkProvider.ts
|
||||||
index 6d9451401a..510f5131ce 100644
|
index 6d9451401a..15e4dcf366 100644
|
||||||
--- a/src/vs/workbench/parts/output/common/outputLinkProvider.ts
|
--- a/src/vs/workbench/parts/output/common/outputLinkProvider.ts
|
||||||
+++ b/src/vs/workbench/parts/output/common/outputLinkProvider.ts
|
+++ b/src/vs/workbench/parts/output/common/outputLinkProvider.ts
|
||||||
@@ -77,0 +78,2 @@ export class OutputLinkProvider {
|
@@ -77,0 +78 @@ export class OutputLinkProvider {
|
||||||
+
|
|
||||||
+ return Promise.resolve([]);
|
+ return Promise.resolve([]);
|
||||||
|
diff --git a/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts b/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts
|
||||||
|
index e6ffdb918b..3960ca32e3 100644
|
||||||
|
--- a/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts
|
||||||
|
@@ -6 +6 @@
|
||||||
|
-import * as env from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -94 +94 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
|
||||||
|
- description: env.isMacintosh ? nls.localize('gotoLineDescriptionMac', "Go to Line") : nls.localize('gotoLineDescriptionWin', "Go to Line")
|
||||||
|
+ description: browser.isMacintosh ? nls.localize('gotoLineDescriptionMac', "Go to Line") : nls.localize('gotoLineDescriptionWin', "Go to Line")
|
||||||
|
diff --git a/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts b/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts
|
||||||
|
index 21d823df72..25e16f7a6f 100644
|
||||||
|
--- a/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts
|
||||||
|
@@ -18 +18,2 @@ import { isEqual } from 'vs/base/common/resources';
|
||||||
|
-import { isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isNative, isLinux } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
|
@@ -69 +70 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
||||||
|
- if (isMacintosh && config.window && typeof config.window.nativeTabs === 'boolean' && config.window.nativeTabs !== this.nativeTabs) {
|
||||||
|
+ if (isNative && isMacintosh && config.window && typeof config.window.nativeTabs === 'boolean' && config.window.nativeTabs !== this.nativeTabs) {
|
||||||
|
@@ -75 +76 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
||||||
|
- if (isMacintosh && config.window && typeof config.window.nativeFullScreen === 'boolean' && config.window.nativeFullScreen !== this.nativeFullScreen) {
|
||||||
|
+ if (isNative && isMacintosh && config.window && typeof config.window.nativeFullScreen === 'boolean' && config.window.nativeFullScreen !== this.nativeFullScreen) {
|
||||||
|
diff --git a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
|
||||||
|
index 920cc42b0a..be9f59e2a5 100644
|
||||||
|
--- a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
|
||||||
|
+++ b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
|
||||||
|
@@ -51 +51 @@ import { IPanelDndController, Panel } from 'vs/base/browser/ui/splitview/panelvi
|
||||||
|
-import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -817 +817 @@ export class RepositoryPanel extends ViewletPanel {
|
||||||
|
- const label = binding ? binding.getLabel() : (platform.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter');
|
||||||
|
+ const label = binding ? binding.getLabel() : (browser.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter');
|
||||||
|
diff --git a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts
|
||||||
|
index a299f18b82..2013a81ab7 100644
|
||||||
|
--- a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts
|
||||||
|
@@ -657 +657 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- included: platform.isMacintosh
|
||||||
|
+ included: platform.isNative && platform.isMacintosh
|
||||||
|
diff --git a/src/vs/workbench/parts/tasks/common/problemMatcher.ts b/src/vs/workbench/parts/tasks/common/problemMatcher.ts
|
||||||
|
index a9889946c2..54bc6aa811 100644
|
||||||
|
--- a/src/vs/workbench/parts/tasks/common/problemMatcher.ts
|
||||||
|
+++ b/src/vs/workbench/parts/tasks/common/problemMatcher.ts
|
||||||
|
@@ -222 +222 @@ export function createLineMatcher(matcher: ProblemMatcher): ILineMatcher {
|
||||||
|
-const endOfLine: string = Platform.OS === Platform.OperatingSystem.Windows ? '\r\n' : '\n';
|
||||||
|
+const endOfLine: string = Platform.isWindows ? '\r\n' : '\n';
|
||||||
|
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 fb600958c8..0698638175 100644
|
||||||
|
--- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
|
||||||
|
@@ -12,0 +13 @@ import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -219 +220 @@ configurationRegistry.registerConfiguration({
|
||||||
|
- default: platform.isMacintosh ? 'selectWord' : platform.isWindows ? 'copyPaste' : 'default',
|
||||||
|
+ default: browser.isMacintosh ? 'selectWord' : browser.isWindows ? 'copyPaste' : 'default',
|
||||||
|
diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts
|
||||||
|
index 31a1d6fc8e..bcfe2b24ec 100644
|
||||||
|
--- a/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts
|
||||||
|
+++ b/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts
|
||||||
|
@@ -7,0 +8 @@ import * as path from 'path';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -214 +215 @@ export class TerminalLinkHandler {
|
||||||
|
- return platform.isMacintosh ? event.metaKey : event.ctrlKey;
|
||||||
|
+ return browser.isMacintosh ? event.metaKey : event.ctrlKey;
|
||||||
|
@@ -222 +223 @@ export class TerminalLinkHandler {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
|
diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
|
||||||
|
index 6395712ee9..f2d1c0769b 100644
|
||||||
|
--- a/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
|
||||||
|
+++ b/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
|
||||||
|
@@ -8,0 +9 @@ import * as platform from 'vs/base/common/platform';
|
||||||
|
+import * as browser from 'vs/base/browser/browser';
|
||||||
|
@@ -232 +233 @@ export class TerminalPanel extends Panel {
|
||||||
|
- if (platform.isMacintosh) {
|
||||||
|
+ if (browser.isMacintosh) {
|
||||||
diff --git a/src/vs/workbench/parts/webview/electron-browser/webview-pre.js b/src/vs/workbench/parts/webview/electron-browser/webview-pre.js
|
diff --git a/src/vs/workbench/parts/webview/electron-browser/webview-pre.js b/src/vs/workbench/parts/webview/electron-browser/webview-pre.js
|
||||||
index 29593dc6b6..dd3d25098d 100644
|
index 29593dc6b6..dd3d25098d 100644
|
||||||
--- a/src/vs/workbench/parts/webview/electron-browser/webview-pre.js
|
--- a/src/vs/workbench/parts/webview/electron-browser/webview-pre.js
|
||||||
@ -189,10 +821,20 @@ index 29593dc6b6..dd3d25098d 100644
|
|||||||
+ // supportFetchAPI: true,
|
+ // supportFetchAPI: true,
|
||||||
+ // corsEnabled: true
|
+ // corsEnabled: true
|
||||||
+ // });
|
+ // });
|
||||||
|
diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts
|
||||||
|
index 033bd98d00..ba776c5ff3 100644
|
||||||
|
--- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts
|
||||||
|
+++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts
|
||||||
|
@@ -24 +24 @@ import { InputFocusedContextKey } from 'vs/platform/workbench/common/contextkeys
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
|
diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
|
||||||
index 5d9110300f..ecdc40b0eb 100644
|
index 5d9110300f..eb16014814 100644
|
||||||
--- a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
|
--- a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
|
||||||
+++ b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
|
+++ b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
|
||||||
|
@@ -21 +21 @@ import { endsWith } from 'vs/base/common/strings';
|
||||||
|
-import { isMacintosh } from 'vs/base/common/platform';
|
||||||
|
+import { isMacintosh } from 'vs/base/browser/browser';
|
||||||
@@ -261,0 +262,3 @@ export class WebviewElement extends Disposable {
|
@@ -261,0 +262,3 @@ export class WebviewElement extends Disposable {
|
||||||
+ Object.defineProperty(this._options, 'useSameOriginForRoot', {
|
+ Object.defineProperty(this._options, 'useSameOriginForRoot', {
|
||||||
+ value: true,
|
+ value: true,
|
||||||
@ -237,11 +879,11 @@ index 147f05b246..fa89583203 100644
|
|||||||
- this.modelService.updateModel(codeEditorModel, content.value);
|
- this.modelService.updateModel(codeEditorModel, content.value);
|
||||||
+ this.modelService.updateModel(codeEditorModel, content);
|
+ this.modelService.updateModel(codeEditorModel, content);
|
||||||
diff --git a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
|
diff --git a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
|
||||||
index 29cbfd65c4..1091dc3c8a 100644
|
index 29cbfd65c4..ee7e776bdb 100644
|
||||||
--- a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
|
--- a/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
|
||||||
+++ b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
|
+++ b/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
|
||||||
@@ -33,0 +34 @@ function getSystemExtensionsRoot(): string {
|
@@ -33,0 +34 @@ function getSystemExtensionsRoot(): string {
|
||||||
+ return (require('vs/../../../../packages/vscode') as typeof import ('vs/../../../../packages/vscode')).client.builtInExtensionsDirectory;
|
+ return (require('vs/../../../../packages/vscode/src/fill/paths') as typeof import ('vs/../../../../packages/vscode/src/fill/paths')).getBuiltInExtensionsDirectory();
|
||||||
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcess.ts b/src/vs/workbench/services/extensions/node/extensionHostProcess.ts
|
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcess.ts b/src/vs/workbench/services/extensions/node/extensionHostProcess.ts
|
||||||
index 5f2935618c..af5498d7ac 100644
|
index 5f2935618c..af5498d7ac 100644
|
||||||
--- a/src/vs/workbench/services/extensions/node/extensionHostProcess.ts
|
--- a/src/vs/workbench/services/extensions/node/extensionHostProcess.ts
|
||||||
|
Loading…
Reference in New Issue
Block a user