mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 15:35:20 +01:00
allow null for remoteAuthority in IBaseOpenWindowsOptions to force local window
This commit is contained in:
@@ -302,7 +302,7 @@ function getActions(): ActionItem[] {
|
||||
actions.push({
|
||||
title: 'Close Remote',
|
||||
execute: async () => {
|
||||
await vscode.commands.executeCommand('vscode.newWindow', { reuseWindow: true });
|
||||
await vscode.commands.executeCommand('vscode.newWindow', { reuseWindow: true, remoteAuthority: null });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
|
||||
gotoLineMode: options.gotoLineMode,
|
||||
noRecentEntry: options.noRecentEntry,
|
||||
waitMarkerFileURI: options.waitMarkerFileURI,
|
||||
remoteAuthority: options.remoteAuthority
|
||||
remoteAuthority: options.remoteAuthority || undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export const WindowMinimumSize = {
|
||||
|
||||
export interface IBaseOpenWindowsOptions {
|
||||
readonly forceReuseWindow?: boolean;
|
||||
readonly remoteAuthority?: string; /* used when no inputs are provided or inputs are neither file nor vscode-remote */
|
||||
readonly remoteAuthority?: string | null; /* used when no inputs are provided or inputs are neither file nor vscode-remote. Null forces a local window */
|
||||
}
|
||||
|
||||
export interface IOpenWindowOptions extends IBaseOpenWindowsOptions {
|
||||
|
||||
@@ -160,7 +160,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
|
||||
openEmptyWindow(openConfig: IOpenEmptyConfiguration, options?: IOpenEmptyWindowOptions): ICodeWindow[] {
|
||||
let cli = this.environmentMainService.args;
|
||||
const remoteAuthority = options?.remoteAuthority;
|
||||
const remoteAuthority = options?.remoteAuthority || undefined;
|
||||
const forceEmpty = true;
|
||||
const forceReuseWindow = options?.forceReuseWindow;
|
||||
const forceNewWindow = !forceReuseWindow;
|
||||
|
||||
@@ -32,7 +32,7 @@ function adjustHandler(handler: (executor: ICommandsExecutor, ...args: any[]) =>
|
||||
|
||||
interface INewWindowAPICommandOptions {
|
||||
reuseWindow?: boolean;
|
||||
remoteAuthority?: string;
|
||||
remoteAuthority?: string | null; /* allow null to force a local window */
|
||||
}
|
||||
|
||||
export class NewWindowAPICommand {
|
||||
|
||||
@@ -343,7 +343,7 @@ export class NewWindowAction extends Action {
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
return this.hostService.openWindow();
|
||||
return this.hostService.openWindow({ remoteAuthority: null });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
|
||||
f1: true
|
||||
});
|
||||
}
|
||||
run = () => that.remoteAuthority && that.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: undefined });
|
||||
run = () => that.remoteAuthority && that.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: null });
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
|
||||
|
||||
@@ -66,8 +66,8 @@ export class NativeHostService extends Disposable implements IHostService {
|
||||
if (!!remoteAuthority) {
|
||||
toOpen.forEach(openable => openable.label = openable.label || this.getRecentLabel(openable));
|
||||
|
||||
if (!options || !options.hasOwnProperty('remoteAuthority')) {
|
||||
// pass the remoteAuthority of the window the request came from.
|
||||
if (options?.remoteAuthority === undefined) {
|
||||
// set the remoteAuthority of the window the request came from.
|
||||
// It will be used when the input is neither file nor vscode-remote.
|
||||
options = options ? { ...options, remoteAuthority } : { remoteAuthority };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user