mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 0fde6619172c9f04c41f2e816479e432cc974b8b (#5199)
This commit is contained in:
@@ -49,6 +49,15 @@ export interface IBaseResourceInput {
|
||||
* looking at the scheme of the resource(s).
|
||||
*/
|
||||
readonly forceFile?: boolean;
|
||||
|
||||
/**
|
||||
* Hint to indicate that this input should be treated as a
|
||||
* untitled file.
|
||||
*
|
||||
* Without this hint, the editor service will make a guess by
|
||||
* looking at the scheme of the resource(s).
|
||||
*/
|
||||
readonly forceUntitled?: boolean;
|
||||
}
|
||||
|
||||
export interface IResourceInput extends IBaseResourceInput {
|
||||
|
||||
@@ -288,7 +288,12 @@ export function markAsFileSystemProviderError(error: Error, code: FileSystemProv
|
||||
return error;
|
||||
}
|
||||
|
||||
export function toFileSystemProviderErrorCode(error: Error): FileSystemProviderErrorCode {
|
||||
export function toFileSystemProviderErrorCode(error: Error | undefined | null): FileSystemProviderErrorCode {
|
||||
|
||||
// Guard against abuse
|
||||
if (!error) {
|
||||
return FileSystemProviderErrorCode.Unknown;
|
||||
}
|
||||
|
||||
// FileSystemProviderError comes with the code
|
||||
if (error instanceof FileSystemProviderError) {
|
||||
@@ -758,12 +763,12 @@ export const FALLBACK_MAX_MEMORY_SIZE_MB = 4096;
|
||||
*/
|
||||
export const ETAG_DISABLED = '';
|
||||
|
||||
export function etag(mtime: number, size: number): string;
|
||||
export function etag(mtime: number | undefined, size: number | undefined): string | undefined;
|
||||
export function etag(mtime: number | undefined, size: number | undefined): string | undefined {
|
||||
if (typeof size !== 'number' || typeof mtime !== 'number') {
|
||||
export function etag(stat: { mtime: number, size: number }): string;
|
||||
export function etag(stat: { mtime: number | undefined, size: number | undefined }): string | undefined;
|
||||
export function etag(stat: { mtime: number | undefined, size: number | undefined }): string | undefined {
|
||||
if (typeof stat.size !== 'number' || typeof stat.mtime !== 'number') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return mtime.toString(29) + size.toString(31);
|
||||
return stat.mtime.toString(29) + stat.size.toString(31);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ configurationRegistry.registerConfiguration({
|
||||
'update.showReleaseNotes': {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
description: localize('showReleaseNotes', "Show Release Notes after an update. The Release Notes are fetched from a Microsoft online service."),
|
||||
tags: ['usesOnlineServices']
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ export const enum ReadyState {
|
||||
|
||||
export interface IPath extends IPathData {
|
||||
|
||||
// the file path to open within a Code instance
|
||||
// the file path to open within the instance
|
||||
fileUri?: URI;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ export interface IPathsToWaitForData {
|
||||
|
||||
export interface IPathData {
|
||||
|
||||
// the file path to open within a Code instance
|
||||
// the file path to open within the instance
|
||||
fileUri?: UriComponents;
|
||||
|
||||
// the line number in the file path to open
|
||||
@@ -382,11 +382,15 @@ export interface IPathData {
|
||||
|
||||
// the column number in the file path to open
|
||||
columnNumber?: number;
|
||||
|
||||
// a hint that the file exists. if true, the
|
||||
// file exists, if false it does not. with
|
||||
// undefined the state is unknown.
|
||||
exists?: boolean;
|
||||
}
|
||||
|
||||
export interface IOpenFileRequest {
|
||||
filesToOpen?: IPathData[];
|
||||
filesToCreate?: IPathData[];
|
||||
filesToOpenOrCreate?: IPathData[];
|
||||
filesToDiff?: IPathData[];
|
||||
filesToWait?: IPathsToWaitForData;
|
||||
termProgram?: string;
|
||||
@@ -430,8 +434,7 @@ export interface IWindowConfiguration extends ParsedArgs {
|
||||
perfWindowLoadTime?: number;
|
||||
perfEntries: ExportData;
|
||||
|
||||
filesToOpen?: IPath[];
|
||||
filesToCreate?: IPath[];
|
||||
filesToOpenOrCreate?: IPath[];
|
||||
filesToDiff?: IPath[];
|
||||
filesToWait?: IPathsToWaitFor;
|
||||
termProgram?: string;
|
||||
|
||||
@@ -74,9 +74,11 @@ export class WindowsService implements IWindowsService {
|
||||
return this.channel.call('closeWorkspace', windowId);
|
||||
}
|
||||
|
||||
enterWorkspace(windowId: number, path: URI): Promise<IEnterWorkspaceResult> {
|
||||
enterWorkspace(windowId: number, path: URI): Promise<IEnterWorkspaceResult | undefined> {
|
||||
return this.channel.call('enterWorkspace', [windowId, path]).then((result: IEnterWorkspaceResult) => {
|
||||
result.workspace = reviveWorkspaceIdentifier(result.workspace);
|
||||
if (result) {
|
||||
result.workspace = reviveWorkspaceIdentifier(result.workspace);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
async getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
|
||||
this.logService.trace('windowsService#getRecentlyOpened', windowId);
|
||||
|
||||
return this.withWindow(windowId, codeWindow => this.historyService.getRecentlyOpened(codeWindow.config.workspace, codeWindow.config.folderUri, codeWindow.config.filesToOpen), () => this.historyService.getRecentlyOpened())!;
|
||||
return this.withWindow(windowId, codeWindow => this.historyService.getRecentlyOpened(codeWindow.config.workspace, codeWindow.config.folderUri, codeWindow.config.filesToOpenOrCreate), () => this.historyService.getRecentlyOpened())!;
|
||||
}
|
||||
|
||||
async newWindowTab(): Promise<void> {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/works
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import { extname } from 'vs/base/common/path';
|
||||
import { dirname, resolvePath, isEqualAuthority, isEqualOrParent, relativePath } from 'vs/base/common/resources';
|
||||
import { dirname, resolvePath, isEqualAuthority, isEqualOrParent, relativePath, extname as resourceExtname } from 'vs/base/common/resources';
|
||||
import * as jsonEdit from 'vs/base/common/jsonEdit';
|
||||
import * as json from 'vs/base/common/json';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
@@ -158,8 +158,10 @@ export function isSingleFolderWorkspaceInitializationPayload(obj: any): obj is I
|
||||
|
||||
const WORKSPACE_SUFFIX = '.' + WORKSPACE_EXTENSION;
|
||||
|
||||
export function hasWorkspaceFileExtension(path: string) {
|
||||
return extname(path) === WORKSPACE_SUFFIX;
|
||||
export function hasWorkspaceFileExtension(path: string | URI) {
|
||||
const ext = (typeof path === 'string') ? extname(path) : resourceExtname(path);
|
||||
|
||||
return ext === WORKSPACE_SUFFIX;
|
||||
}
|
||||
|
||||
const SLASH = '/';
|
||||
|
||||
@@ -61,7 +61,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
|
||||
}
|
||||
|
||||
private isWorkspacePath(uri: URI): boolean {
|
||||
return this.isInsideWorkspacesHome(uri) || hasWorkspaceFileExtension(uri.path);
|
||||
return this.isInsideWorkspacesHome(uri) || hasWorkspaceFileExtension(uri);
|
||||
}
|
||||
|
||||
private doResolveWorkspace(path: URI, contents: string): IResolvedWorkspace | null {
|
||||
|
||||
Reference in New Issue
Block a user