Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -7,7 +7,7 @@ import { sep } from 'vs/base/common/path';
import { URI } from 'vs/base/common/uri';
import * as glob from 'vs/base/common/glob';
import { isLinux } from 'vs/base/common/platform';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { Event } from 'vs/base/common/event';
import { startsWithIgnoreCase } from 'vs/base/common/strings';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -26,7 +26,8 @@ export interface IResourceEncoding {
}
export interface IFileService {
_serviceBrand: any;
_serviceBrand: ServiceIdentifier<any>;
//#region File System Provider
@@ -59,7 +60,7 @@ export interface IFileService {
/**
* Checks if the provider for the provided resource has the provided file system capability.
*/
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): Promise<boolean>;
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean;
//#endregion
@@ -163,14 +164,11 @@ export interface IFileService {
del(resource: URI, options?: { useTrash?: boolean, recursive?: boolean }): Promise<void>;
/**
* Allows to start a watcher that reports file change events on the provided resource.
* Allows to start a watcher that reports file/folder change events on the provided resource.
*
* Note: watching a folder does not report events recursively for child folders yet.
*/
watch(resource: URI): void;
/**
* Allows to stop a watcher on the provided resource or absolute fs path.
*/
unwatch(resource: URI): void;
watch(resource: URI): IDisposable;
/**
* Frees up any resources occupied by this service.
@@ -231,6 +229,8 @@ export interface IFileSystemProvider {
readonly capabilities: FileSystemProviderCapabilities;
onDidChangeCapabilities: Event<void>;
onDidErrorOccur?: Event<Error>; // TODO@ben remove once file watchers are solid
onDidChangeFile: Event<IFileChange[]>;
watch(resource: URI, opts: IWatchOptions): IDisposable;
@@ -801,7 +801,7 @@ export class FileOperationError extends Error {
super(message);
}
static isFileOperationError(obj: any): obj is FileOperationError {
static isFileOperationError(obj: unknown): obj is FileOperationError {
return obj instanceof Error && !isUndefinedOrNull((obj as FileOperationError).fileOperationResult);
}
}
@@ -851,8 +851,8 @@ export interface IFilesConfiguration {
autoSave: string;
autoSaveDelay: number;
eol: string;
enableTrash: boolean;
hotExit: string;
useExperimentalFileWatcher: boolean;
};
}
@@ -1119,23 +1119,20 @@ export function etag(mtime: number | undefined, size: number | undefined): strin
// TODO@ben remove traces of legacy file service
export const ILegacyFileService = createDecorator<ILegacyFileService>('legacyFileService');
export interface ILegacyFileService {
export interface ILegacyFileService extends IDisposable {
_serviceBrand: any;
encoding: IResourceEncodings;
onFileChanges: Event<FileChangesEvent>;
onAfterOperation: Event<FileOperationEvent>;
registerProvider(scheme: string, provider: IFileSystemProvider): IDisposable;
resolveContent(resource: URI, options?: IResolveContentOptions): Promise<IContent>;
resolveStreamContent(resource: URI, options?: IResolveContentOptions): Promise<IStreamContent>;
updateContent(resource: URI, value: string | ITextSnapshot, options?: IUpdateContentOptions): Promise<IFileStat>;
updateContent(resource: URI, value: string | ITextSnapshot, options?: IUpdateContentOptions): Promise<IFileStatWithMetadata>;
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStat>;
watch(resource: URI): void;
unwatch(resource: URI): void;
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStatWithMetadata>;
}