mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge vscode source through 1.62 release (#19981)
* Build breaks 1 * Build breaks * Build breaks * Build breaks * More build breaks * Build breaks (#2512) * Runtime breaks * Build breaks * Fix dialog location break * Update typescript * Fix ASAR break issue * Unit test breaks * Update distro * Fix breaks in ADO builds (#2513) * Bump to node 16 * Fix hygiene errors * Bump distro * Remove reference to node type * Delete vscode specific extension * Bump to node 16 in CI yaml * Skip integration tests in CI builds (while fixing) * yarn.lock update * Bump moment dependency in remote yarn * Fix drop-down chevron style * Bump to node 16 * Remove playwrite from ci.yaml * Skip building build scripts in hygine check
This commit is contained in:
@@ -128,13 +128,17 @@ export interface IWindowSettings {
|
||||
readonly clickThroughInactive: boolean;
|
||||
}
|
||||
|
||||
interface IWindowBorderColors {
|
||||
readonly 'window.activeBorder'?: string;
|
||||
readonly 'window.inactiveBorder'?: string;
|
||||
}
|
||||
|
||||
export function getTitleBarStyle(configurationService: IConfigurationService): 'native' | 'custom' {
|
||||
if (isWeb) {
|
||||
return 'custom';
|
||||
}
|
||||
|
||||
const configuration = configurationService.getValue<IWindowSettings | undefined>('window');
|
||||
|
||||
if (configuration) {
|
||||
const useNativeTabs = isMacintosh && configuration.nativeTabs === true;
|
||||
if (useNativeTabs) {
|
||||
@@ -146,6 +150,11 @@ export function getTitleBarStyle(configurationService: IConfigurationService): '
|
||||
return 'native'; // simple fullscreen does not work well with custom title style (https://github.com/microsoft/vscode/issues/63291)
|
||||
}
|
||||
|
||||
const colorCustomizations = configurationService.getValue<IWindowBorderColors | undefined>('workbench.colorCustomizations');
|
||||
if (colorCustomizations?.['window.activeBorder'] || colorCustomizations?.['window.inactiveBorder']) {
|
||||
return 'custom'; // window border colors do not work with native title style
|
||||
}
|
||||
|
||||
const style = configuration.titleBarStyle;
|
||||
if (style === 'native' || style === 'custom') {
|
||||
return style;
|
||||
@@ -229,9 +238,6 @@ export interface IColorScheme {
|
||||
export interface IWindowConfiguration {
|
||||
remoteAuthority?: string;
|
||||
|
||||
colorScheme: IColorScheme;
|
||||
autoDetectHighContrast?: boolean;
|
||||
|
||||
filesToOpenOrCreate?: IPath[];
|
||||
filesToDiff?: IPath[];
|
||||
}
|
||||
@@ -288,6 +294,11 @@ export interface INativeWindowConfiguration extends IWindowConfiguration, Native
|
||||
fullscreen?: boolean;
|
||||
maximized?: boolean;
|
||||
accessibilitySupport?: boolean;
|
||||
colorScheme: IColorScheme;
|
||||
autoDetectHighContrast?: boolean;
|
||||
|
||||
legacyWatcher?: string; // TODO@bpasero remove me once watcher is settled
|
||||
experimentalSandboxedFileService?: boolean; // TODO@bpasero remove me once sandbox is settled
|
||||
|
||||
perfMarks: PerformanceMark[];
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { app, BrowserWindow, BrowserWindowConstructorOptions, Display, Event, nativeImage, NativeImage, Rectangle, screen, SegmentedControlSegment, systemPreferences, TouchBar, TouchBarSegmentedControl, WebFrameMain } from 'electron';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
@@ -32,8 +33,8 @@ import { IStorageMainService } from 'vs/platform/storage/electron-main/storageMa
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
|
||||
import { getMenuBarVisibility, getTitleBarStyle, INativeWindowConfiguration, IWindowSettings, MenuBarVisibility, WindowMinimumSize, zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
|
||||
import { defaultWindowState, ICodeWindow, ILoadEvent, IWindowState, LoadReason, WindowError, WindowMode } from 'vs/platform/windows/electron-main/windows';
|
||||
import { getMenuBarVisibility, getTitleBarStyle, IFolderToOpen, INativeWindowConfiguration, IWindowSettings, IWorkspaceToOpen, MenuBarVisibility, WindowMinimumSize, zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
|
||||
import { defaultWindowState, ICodeWindow, ILoadEvent, IWindowsMainService, IWindowState, LoadReason, OpenContext, WindowError, WindowMode } from 'vs/platform/windows/electron-main/windows';
|
||||
import { ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspacesManagementMainService } from 'vs/platform/workspaces/electron-main/workspacesManagementMainService';
|
||||
|
||||
@@ -158,7 +159,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
@IDialogMainService private readonly dialogMainService: IDialogMainService,
|
||||
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
|
||||
@IWindowsMainService private readonly windowsMainService: IWindowsMainService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -302,7 +304,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this.createTouchBar();
|
||||
|
||||
// Request handling
|
||||
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(this.productService.version, this.environmentMainService, this.fileService, {
|
||||
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(this.productService.version, this.productService, this.environmentMainService, this.configurationService, this.fileService, {
|
||||
get: key => storageMainService.globalStorage.get(key),
|
||||
store: (key, value) => storageMainService.globalStorage.set(key, value)
|
||||
});
|
||||
@@ -434,7 +436,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
});
|
||||
|
||||
// Block all SVG requests from unsupported origins
|
||||
const supportedSvgSchemes = new Set([Schemas.file, Schemas.vscodeFileResource, Schemas.vscodeRemoteResource, 'devtools']); // TODO@mjbvz: handle webview origin
|
||||
const supportedSvgSchemes = new Set([Schemas.file, Schemas.vscodeFileResource, Schemas.vscodeRemoteResource, 'devtools']);
|
||||
|
||||
// But allow them if the are made from inside an webview
|
||||
const isSafeFrame = (requestFrame: WebFrameMain | undefined): boolean => {
|
||||
@@ -453,7 +455,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this._win.webContents.session.webRequest.onBeforeRequest((details, callback) => {
|
||||
const uri = URI.parse(details.url);
|
||||
if (uri.path.endsWith('.svg')) {
|
||||
const isSafeResourceUrl = supportedSvgSchemes.has(uri.scheme) || uri.path.includes(Schemas.vscodeRemoteResource);
|
||||
const isSafeResourceUrl = supportedSvgSchemes.has(uri.scheme);
|
||||
if (!isSafeResourceUrl) {
|
||||
return callback({ cancel: !isRequestFromSafeContext(details) });
|
||||
}
|
||||
@@ -617,15 +619,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
cancelId: 1
|
||||
}, this._win);
|
||||
|
||||
if (!this._win) {
|
||||
return; // Return early if the window has been going down already
|
||||
}
|
||||
|
||||
if (result.response === 0) {
|
||||
this._win.webContents.forcefullyCrashRenderer(); // Calling reload() immediately after calling this method will force the reload to occur in a new process
|
||||
this.reload();
|
||||
} else if (result.response === 2) {
|
||||
this.destroyWindow();
|
||||
// Handle choice
|
||||
if (result.response !== 1 /* keep waiting */) {
|
||||
const reopen = result.response === 0;
|
||||
this.destroyWindow(reopen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,6 +635,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
message = localize('appCrashedDetails', "The window has crashed (reason: '{0}', code: '{1}')", details.reason, details.exitCode ?? '<unknown>');
|
||||
}
|
||||
|
||||
// Show Dialog
|
||||
const result = await this.dialogMainService.showMessageBox({
|
||||
title: this.productService.nameLong,
|
||||
type: 'warning',
|
||||
@@ -651,23 +649,50 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
defaultId: 0
|
||||
}, this._win);
|
||||
|
||||
if (!this._win) {
|
||||
return; // Return early if the window has been going down already
|
||||
}
|
||||
|
||||
if (result.response === 0) {
|
||||
this.reload();
|
||||
} else if (result.response === 1) {
|
||||
this.destroyWindow();
|
||||
}
|
||||
// Handle choice
|
||||
const reopen = result.response === 0;
|
||||
this.destroyWindow(reopen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private destroyWindow(): void {
|
||||
this._onDidDestroy.fire(); // 'close' event will not be fired on destroy(), so signal crash via explicit event
|
||||
this._win.destroy(); // make sure to destroy the window as it has crashed
|
||||
private destroyWindow(reopen: boolean): void {
|
||||
|
||||
// 'close' event will not be fired on destroy(), so signal crash via explicit event
|
||||
this._onDidDestroy.fire();
|
||||
|
||||
// make sure to destroy the window as it has crashed
|
||||
this._win?.destroy();
|
||||
|
||||
// ask the windows service to open a new fresh window if specified
|
||||
if (reopen && this.config) {
|
||||
|
||||
// We have to reconstruct a openable from the current workspace
|
||||
let workspace: IWorkspaceToOpen | IFolderToOpen | undefined = undefined;
|
||||
let forceEmpty = undefined;
|
||||
if (isSingleFolderWorkspaceIdentifier(this.openedWorkspace)) {
|
||||
workspace = { folderUri: this.openedWorkspace.uri };
|
||||
} else if (isWorkspaceIdentifier(this.openedWorkspace)) {
|
||||
workspace = { workspaceUri: this.openedWorkspace.configPath };
|
||||
} else {
|
||||
forceEmpty = true;
|
||||
}
|
||||
|
||||
// Delegate to windows service
|
||||
const [window] = this.windowsMainService.open({
|
||||
context: OpenContext.API,
|
||||
userEnv: this.config.userEnv,
|
||||
cli: {
|
||||
...this.environmentMainService.args,
|
||||
_: [] // we pass in the workspace to open explicitly via `urisToOpen`
|
||||
},
|
||||
urisToOpen: workspace ? [workspace] : undefined,
|
||||
forceEmpty,
|
||||
forceNewWindow: true
|
||||
});
|
||||
window.focus();
|
||||
}
|
||||
}
|
||||
|
||||
private onDidDeleteUntitledWorkspace(workspace: IWorkspaceIdentifier): void {
|
||||
@@ -844,6 +869,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
if (this.isExtensionDevelopmentHost && cli) {
|
||||
configuration.verbose = cli.verbose;
|
||||
configuration.debugId = cli.debugId;
|
||||
configuration.extensionEnvironment = cli.extensionEnvironment;
|
||||
configuration['inspect-extensions'] = cli['inspect-extensions'];
|
||||
configuration['inspect-brk-extensions'] = cli['inspect-brk-extensions'];
|
||||
configuration['extensions-dir'] = cli['extensions-dir'];
|
||||
@@ -1290,11 +1316,15 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
send(channel: string, ...args: any[]): void {
|
||||
if (this._win) {
|
||||
if (this._win.isDestroyed() || this._win.webContents.isDestroyed()) {
|
||||
this.logService.warn(`Sending IPC message to channel ${channel} for window that is destroyed`);
|
||||
this.logService.warn(`Sending IPC message to channel '${channel}' for window that is destroyed`);
|
||||
return;
|
||||
}
|
||||
|
||||
this._win.webContents.send(channel, ...args);
|
||||
try {
|
||||
this._win.webContents.send(channel, ...args);
|
||||
} catch (error) {
|
||||
this.logService.warn(`Error sending IPC message to channel '${channel}' of window ${this._id}: ${toErrorMessage(error)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -204,6 +204,7 @@ export interface IWindowsMainService {
|
||||
|
||||
open(openConfig: IOpenConfiguration): ICodeWindow[];
|
||||
openEmptyWindow(openConfig: IOpenEmptyConfiguration, options?: IOpenEmptyWindowOptions): ICodeWindow[];
|
||||
openExistingWindow(window: ICodeWindow, openConfig: IOpenConfiguration): void;
|
||||
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string[], openConfig: IOpenConfiguration): ICodeWindow[];
|
||||
|
||||
sendToFocused(channel: string, ...args: any[]): void;
|
||||
|
||||
@@ -17,9 +17,10 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { basename, join, normalize, posix } from 'vs/base/common/path';
|
||||
import { getMarks, mark } from 'vs/base/common/performance';
|
||||
import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
|
||||
import { IProcessEnvironment, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { cwd } from 'vs/base/common/process';
|
||||
import { extUriBiasedIgnorePathCase, normalizePath, originalFSPath, removeTrailingPathSeparator } from 'vs/base/common/resources';
|
||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||
import { assertIsDefined, withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -231,6 +232,15 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
return this.open({ ...openConfig, cli, forceEmpty, forceNewWindow, forceReuseWindow, remoteAuthority });
|
||||
}
|
||||
|
||||
openExistingWindow(window: ICodeWindow, openConfig: IOpenConfiguration): void {
|
||||
|
||||
// Bring window to front
|
||||
window.focus();
|
||||
|
||||
// Handle --wait
|
||||
this.handleWaitMarkerFile(openConfig, [window]);
|
||||
}
|
||||
|
||||
open(openConfig: IOpenConfiguration): ICodeWindow[] {
|
||||
this.logService.trace('windowsManager#open');
|
||||
|
||||
@@ -275,10 +285,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
}
|
||||
|
||||
// When run with --diff, take the files to open as files to diff
|
||||
// if there are exactly two files provided.
|
||||
if (openConfig.diffMode && filesToOpen?.filesToOpenOrCreate.length === 2) {
|
||||
filesToOpen.filesToDiff = filesToOpen.filesToOpenOrCreate;
|
||||
// When run with --diff, take the first 2 files to open as files to diff
|
||||
if (openConfig.diffMode && filesToOpen && filesToOpen.filesToOpenOrCreate.length >= 2) {
|
||||
filesToOpen.filesToDiff = filesToOpen.filesToOpenOrCreate.slice(0, 2);
|
||||
filesToOpen.filesToOpenOrCreate = [];
|
||||
}
|
||||
|
||||
@@ -371,6 +380,14 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
this.workspacesHistoryMainService.addRecentlyOpened(recents);
|
||||
}
|
||||
|
||||
// Handle --wait
|
||||
this.handleWaitMarkerFile(openConfig, usedWindows);
|
||||
|
||||
return usedWindows;
|
||||
}
|
||||
|
||||
private handleWaitMarkerFile(openConfig: IOpenConfiguration, usedWindows: ICodeWindow[]): void {
|
||||
|
||||
// If we got started with --wait from the CLI, we need to signal to the outside when the window
|
||||
// used for the edit operation is closed or loaded to a different folder so that the waiting
|
||||
// process can continue. We do this by deleting the waitMarkerFilePath.
|
||||
@@ -386,8 +403,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
return usedWindows;
|
||||
}
|
||||
|
||||
private doOpen(
|
||||
@@ -434,7 +449,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
const fileToCheck = filesToOpen.filesToOpenOrCreate[0] || filesToOpen.filesToDiff[0];
|
||||
|
||||
// only look at the windows with correct authority
|
||||
const windows = this.getWindows().filter(window => filesToOpen && window.remoteAuthority === filesToOpen.remoteAuthority);
|
||||
const windows = this.getWindows().filter(window => filesToOpen && isEqualAuthority(window.remoteAuthority, filesToOpen.remoteAuthority));
|
||||
|
||||
// figure out a good window to open the files in if any
|
||||
// with a fallback to the last active window.
|
||||
@@ -493,7 +508,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
const windowsOnWorkspace = coalesce(allWorkspacesToOpen.map(workspaceToOpen => findWindowOnWorkspaceOrFolder(this.getWindows(), workspaceToOpen.workspace.configPath)));
|
||||
if (windowsOnWorkspace.length > 0) {
|
||||
const windowOnWorkspace = windowsOnWorkspace[0];
|
||||
const filesToOpenInWindow = (filesToOpen?.remoteAuthority === windowOnWorkspace.remoteAuthority) ? filesToOpen : undefined;
|
||||
const filesToOpenInWindow = isEqualAuthority(filesToOpen?.remoteAuthority, windowOnWorkspace.remoteAuthority) ? filesToOpen : undefined;
|
||||
|
||||
// Do open files
|
||||
addUsedWindow(this.doOpenFilesInExistingWindow(openConfig, windowOnWorkspace, filesToOpenInWindow), !!filesToOpenInWindow);
|
||||
@@ -508,7 +523,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
|
||||
const remoteAuthority = workspaceToOpen.remoteAuthority;
|
||||
const filesToOpenInWindow = (filesToOpen?.remoteAuthority === remoteAuthority) ? filesToOpen : undefined;
|
||||
const filesToOpenInWindow = isEqualAuthority(filesToOpen?.remoteAuthority, remoteAuthority) ? filesToOpen : undefined;
|
||||
|
||||
// Do open folder
|
||||
addUsedWindow(this.doOpenFolderOrWorkspace(openConfig, workspaceToOpen, openFolderInNewWindow, filesToOpenInWindow), !!filesToOpenInWindow);
|
||||
@@ -525,7 +540,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
const windowsOnFolderPath = coalesce(allFoldersToOpen.map(folderToOpen => findWindowOnWorkspaceOrFolder(this.getWindows(), folderToOpen.workspace.uri)));
|
||||
if (windowsOnFolderPath.length > 0) {
|
||||
const windowOnFolderPath = windowsOnFolderPath[0];
|
||||
const filesToOpenInWindow = filesToOpen?.remoteAuthority === windowOnFolderPath.remoteAuthority ? filesToOpen : undefined;
|
||||
const filesToOpenInWindow = isEqualAuthority(filesToOpen?.remoteAuthority, windowOnFolderPath.remoteAuthority) ? filesToOpen : undefined;
|
||||
|
||||
// Do open files
|
||||
addUsedWindow(this.doOpenFilesInExistingWindow(openConfig, windowOnFolderPath, filesToOpenInWindow), !!filesToOpenInWindow);
|
||||
@@ -540,7 +555,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
|
||||
const remoteAuthority = folderToOpen.remoteAuthority;
|
||||
const filesToOpenInWindow = (filesToOpen?.remoteAuthority === remoteAuthority) ? filesToOpen : undefined;
|
||||
const filesToOpenInWindow = isEqualAuthority(filesToOpen?.remoteAuthority, remoteAuthority) ? filesToOpen : undefined;
|
||||
|
||||
// Do open folder
|
||||
addUsedWindow(this.doOpenFolderOrWorkspace(openConfig, folderToOpen, openFolderInNewWindow, filesToOpenInWindow), !!filesToOpenInWindow);
|
||||
@@ -554,7 +569,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
if (allEmptyToRestore.length > 0) {
|
||||
allEmptyToRestore.forEach(emptyWindowBackupInfo => {
|
||||
const remoteAuthority = emptyWindowBackupInfo.remoteAuthority;
|
||||
const filesToOpenInWindow = (filesToOpen?.remoteAuthority === remoteAuthority) ? filesToOpen : undefined;
|
||||
const filesToOpenInWindow = isEqualAuthority(filesToOpen?.remoteAuthority, remoteAuthority) ? filesToOpen : undefined;
|
||||
|
||||
addUsedWindow(this.openInBrowserWindow({
|
||||
userEnv: openConfig.userEnv,
|
||||
@@ -696,7 +711,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
const foldersToOpen = pathsToOpen.filter(path => isSingleFolderWorkspacePathToOpen(path)) as ISingleFolderWorkspacePathToOpen[];
|
||||
if (foldersToOpen.length > 1) {
|
||||
const remoteAuthority = foldersToOpen[0].remoteAuthority;
|
||||
if (foldersToOpen.every(folderToOpen => folderToOpen.remoteAuthority === remoteAuthority)) { // only if all folder have the same authority
|
||||
if (foldersToOpen.every(folderToOpen => isEqualAuthority(folderToOpen.remoteAuthority, remoteAuthority))) { // only if all folder have the same authority
|
||||
const workspace = this.workspacesManagementMainService.createUntitledWorkspaceSync(foldersToOpen.map(folder => ({ uri: folder.workspace.uri })));
|
||||
|
||||
// Add workspace and remove folders thereby
|
||||
@@ -959,6 +974,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
|
||||
try {
|
||||
const pathStat = statSync(path);
|
||||
|
||||
// File
|
||||
if (pathStat.isFile()) {
|
||||
|
||||
// Workspace (unless disabled via flag)
|
||||
@@ -976,7 +993,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
}
|
||||
|
||||
// File
|
||||
return {
|
||||
fileUri: URI.file(path),
|
||||
selection: lineNumber ? { startLineNumber: lineNumber, startColumn: columnNumber || 1 } : undefined,
|
||||
@@ -984,11 +1000,23 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
};
|
||||
}
|
||||
|
||||
// Folder (we check for isDirectory() because e.g. paths like /dev/null
|
||||
// are neither file nor folder but some external tools might pass them
|
||||
// over to us)
|
||||
// Folder
|
||||
else if (pathStat.isDirectory()) {
|
||||
return { workspace: getSingleFolderWorkspaceIdentifier(URI.file(path), pathStat), exists: true };
|
||||
return {
|
||||
workspace: getSingleFolderWorkspaceIdentifier(URI.file(path), pathStat),
|
||||
exists: true
|
||||
};
|
||||
}
|
||||
|
||||
// Special device: in POSIX environments, we may get /dev/null passed
|
||||
// in (for example git uses it to signal one side of a diff does not
|
||||
// exist). In that special case, treat it like a file to support this
|
||||
// scenario ()
|
||||
else if (!isWindows && path === '/dev/null') {
|
||||
return {
|
||||
fileUri: URI.file(path),
|
||||
exists: true
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
const fileUri = URI.file(path);
|
||||
@@ -998,7 +1026,10 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
|
||||
// assume this is a file that does not yet exist
|
||||
if (options.ignoreFileNotFound) {
|
||||
return { fileUri, exists: false };
|
||||
return {
|
||||
fileUri,
|
||||
exists: false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1256,6 +1287,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
os: { release: release(), hostname: hostname() },
|
||||
zoomLevel: typeof windowConfig?.zoomLevel === 'number' ? windowConfig.zoomLevel : undefined,
|
||||
|
||||
legacyWatcher: this.configurationService.getValue('files.legacyWatcher'),
|
||||
experimentalSandboxedFileService: this.configurationService.getValue('files.experimentalSandboxedFileService'),
|
||||
autoDetectHighContrast: windowConfig?.autoDetectHighContrast ?? true,
|
||||
accessibilitySupport: app.accessibilitySupportEnabled,
|
||||
colorScheme: {
|
||||
@@ -1326,6 +1359,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
configuration.verbose = currentWindowConfig.verbose;
|
||||
configuration['inspect-brk-extensions'] = currentWindowConfig['inspect-brk-extensions'];
|
||||
configuration.debugId = currentWindowConfig.debugId;
|
||||
configuration.extensionEnvironment = currentWindowConfig.extensionEnvironment;
|
||||
configuration['inspect-extensions'] = currentWindowConfig['inspect-extensions'];
|
||||
configuration['extensions-dir'] = currentWindowConfig['extensions-dir'];
|
||||
}
|
||||
@@ -1393,7 +1427,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
|
||||
private getLastActiveWindowForAuthority(remoteAuthority: string | undefined): ICodeWindow | undefined {
|
||||
return this.doGetLastActiveWindow(this.getWindows().filter(window => window.remoteAuthority === remoteAuthority));
|
||||
return this.doGetLastActiveWindow(this.getWindows().filter(window => isEqualAuthority(window.remoteAuthority, remoteAuthority)));
|
||||
}
|
||||
|
||||
private doGetLastActiveWindow(windows: ICodeWindow[]): ICodeWindow | undefined {
|
||||
@@ -1443,3 +1477,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
return this.getWindowById(browserWindow.id);
|
||||
}
|
||||
}
|
||||
|
||||
function isEqualAuthority(a1: string | undefined, a2: string | undefined) {
|
||||
return a1 === a2 || (a1 !== undefined && a2 !== undefined && equalsIgnoreCase(a1, a2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user