wco - hardcode devtools location on Linux (#227084)
This commit is contained in:
Родитель
79c48eaf5f
Коммит
dfb96d11d3
|
@ -217,24 +217,6 @@ export interface FileFilter {
|
|||
name: string;
|
||||
}
|
||||
|
||||
export interface OpenDevToolsOptions {
|
||||
/**
|
||||
* Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
|
||||
* `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
|
||||
* possible to dock back. In `detach` mode it's not.
|
||||
*/
|
||||
mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
|
||||
/**
|
||||
* Whether to bring the opened devtools window to the foreground. The default is
|
||||
* `true`.
|
||||
*/
|
||||
activate?: boolean;
|
||||
/**
|
||||
* A title for the DevTools window (only in `undocked` or `detach` mode).
|
||||
*/
|
||||
title?: string;
|
||||
}
|
||||
|
||||
interface InputEvent {
|
||||
|
||||
// Docs: https://electronjs.org/docs/api/structures/input-event
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { ISerializableCommandAction } from 'vs/platform/action/common/action';
|
||||
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
@ -178,7 +178,7 @@ export interface ICommonNativeHostService {
|
|||
exit(code: number): Promise<void>;
|
||||
|
||||
// Development
|
||||
openDevTools(options?: Partial<OpenDevToolsOptions> & INativeHostOptions): Promise<void>;
|
||||
openDevTools(options?: INativeHostOptions): Promise<void>;
|
||||
toggleDevTools(options?: INativeHostOptions): Promise<void>;
|
||||
|
||||
// Perf Introspection
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import { exec } from 'child_process';
|
||||
import { app, BrowserWindow, clipboard, Display, Menu, MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, powerMonitor, SaveDialogOptions, SaveDialogReturnValue, screen, shell, webContents } from 'electron';
|
||||
import { app, BrowserWindow, clipboard, Display, Menu, MessageBoxOptions, MessageBoxReturnValue, OpenDialogOptions, OpenDialogReturnValue, powerMonitor, SaveDialogOptions, SaveDialogReturnValue, screen, shell, webContents } from 'electron';
|
||||
import { arch, cpus, freemem, loadavg, platform, release, totalmem, type } from 'os';
|
||||
import { promisify } from 'util';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
|
@ -33,7 +33,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
|||
import { IPartsSplash } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
|
||||
import { ICodeWindow } from 'vs/platform/window/electron-main/window';
|
||||
import { IColorScheme, IOpenedAuxiliaryWindow, IOpenedMainWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPoint, IRectangle, IWindowOpenable } from 'vs/platform/window/common/window';
|
||||
import { IColorScheme, IOpenedAuxiliaryWindow, IOpenedMainWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPoint, IRectangle, IWindowOpenable, useWindowControlsOverlay } from 'vs/platform/window/common/window';
|
||||
import { IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows';
|
||||
import { isWorkspaceIdentifier, toWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkspacesManagementMainService } from 'vs/platform/workspaces/electron-main/workspacesManagementMainService';
|
||||
|
@ -855,14 +855,28 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
|
|||
|
||||
//#region Development
|
||||
|
||||
async openDevTools(windowId: number | undefined, options?: Partial<OpenDevToolsOptions> & INativeHostOptions): Promise<void> {
|
||||
async openDevTools(windowId: number | undefined, options?: INativeHostOptions): Promise<void> {
|
||||
const window = this.windowById(options?.targetWindowId, windowId);
|
||||
window?.win?.webContents.openDevTools(options?.mode ? { mode: options.mode, activate: options.activate } : undefined);
|
||||
|
||||
let mode: 'bottom' | undefined = undefined;
|
||||
if (isLinux && useWindowControlsOverlay(this.configurationService)) {
|
||||
mode = 'bottom'; // TODO@bpasero WCO and devtools collide with default option 'right'
|
||||
}
|
||||
window?.win?.webContents.openDevTools(mode ? { mode } : undefined);
|
||||
}
|
||||
|
||||
async toggleDevTools(windowId: number | undefined, options?: INativeHostOptions): Promise<void> {
|
||||
const window = this.windowById(options?.targetWindowId, windowId);
|
||||
window?.win?.webContents.toggleDevTools();
|
||||
const webContents = window?.win?.webContents;
|
||||
if (!webContents) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLinux && useWindowControlsOverlay(this.configurationService) && !webContents.isDevToolsOpened()) {
|
||||
webContents.openDevTools({ mode: 'bottom' }); // TODO@bpasero WCO and devtools collide with default option 'right'
|
||||
} else {
|
||||
webContents.toggleDevTools();
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
|
|
@ -143,7 +143,7 @@ export class TestNativeHostService implements INativeHostService {
|
|||
async closeWindow(): Promise<void> { }
|
||||
async quit(): Promise<void> { }
|
||||
async exit(code: number): Promise<void> { }
|
||||
async openDevTools(options?: Partial<Electron.OpenDevToolsOptions> & INativeHostOptions | undefined): Promise<void> { }
|
||||
async openDevTools(): Promise<void> { }
|
||||
async toggleDevTools(): Promise<void> { }
|
||||
async resolveProxy(url: string): Promise<string | undefined> { return undefined; }
|
||||
async lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined> { return undefined; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче