Merge from vscode b8c2e7108b3cae7aa2782112da654bedd8bb3a52 (#4808)

This commit is contained in:
Karl Burtram
2019-04-02 14:35:06 -07:00
committed by GitHub
parent e83a6f9c2e
commit f8706abebe
53 changed files with 495 additions and 584 deletions

View File

@@ -114,12 +114,12 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
private onFileOperation(e: FileOperationEvent): void {
// Handle moves specially when file is opened
if (e.operation === FileOperation.MOVE && e.target) {
if (e.isOperation(FileOperation.MOVE)) {
this.handleMovedFileInOpenedEditors(e.resource, e.target.resource);
}
// Handle deletes
if (e.operation === FileOperation.DELETE || e.operation === FileOperation.MOVE) {
if (e.isOperation(FileOperation.DELETE) || e.isOperation(FileOperation.MOVE)) {
this.handleDeletes(e.resource, false, e.target ? e.target.resource : undefined);
}
}
@@ -176,7 +176,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
// flag.
let checkExists: Promise<boolean>;
if (isExternal) {
checkExists = timeout(100).then(() => this.fileService.existsFile(resource));
checkExists = timeout(100).then(() => this.fileService.exists(resource));
} else {
checkExists = Promise.resolve(false);
}
@@ -360,7 +360,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
// Handle no longer visible out of workspace resources
this.activeOutOfWorkspaceWatchers.forEach(resource => {
if (!visibleOutOfWorkspacePaths.get(resource)) {
this.fileService.unwatchFileChanges(resource);
this.fileService.unwatch(resource);
this.activeOutOfWorkspaceWatchers.delete(resource);
}
});
@@ -368,7 +368,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
// Handle newly visible out of workspace resources
visibleOutOfWorkspacePaths.forEach(resource => {
if (!this.activeOutOfWorkspaceWatchers.get(resource)) {
this.fileService.watchFileChanges(resource);
this.fileService.watch(resource);
this.activeOutOfWorkspaceWatchers.set(resource, resource);
}
});
@@ -378,7 +378,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
super.dispose();
// Dispose watchers if any
this.activeOutOfWorkspaceWatchers.forEach(resource => this.fileService.unwatchFileChanges(resource));
this.activeOutOfWorkspaceWatchers.forEach(resource => this.fileService.unwatch(resource));
this.activeOutOfWorkspaceWatchers.clear();
}
}

View File

@@ -503,7 +503,7 @@ class PasteFileAction extends BaseErrorReportingAction {
throw new Error(nls.localize('fileIsAncestor', "File to paste is an ancestor of the destination folder"));
}
return this.fileService.resolveFile(fileToPaste).then(fileToPasteStat => {
return this.fileService.resolve(fileToPaste).then(fileToPasteStat => {
// Find target
let target: ExplorerItem;
@@ -516,7 +516,7 @@ class PasteFileAction extends BaseErrorReportingAction {
const targetFile = findValidPasteFileTarget(target, { resource: fileToPaste, isDirectory: fileToPasteStat.isDirectory, allowOverwirte: pasteShouldMove });
// Copy File
const promise = pasteShouldMove ? this.fileService.moveFile(fileToPaste, targetFile) : this.fileService.copyFile(fileToPaste, targetFile);
const promise = pasteShouldMove ? this.fileService.move(fileToPaste, targetFile) : this.fileService.copy(fileToPaste, targetFile);
return promise.then<ITextEditor | undefined>(stat => {
if (pasteShouldMove) {
// Cut is done. Make sure to clear cut state.

View File

@@ -300,7 +300,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
// Set side input
if (resources.length) {
return fileService.resolveFiles(resources.map(resource => ({ resource }))).then(resolved => {
return fileService.resolveAll(resources.map(resource => ({ resource }))).then(resolved => {
const editors = resolved.filter(r => r.stat && r.success && !r.stat.isDirectory).map(r => ({
resource: r.stat!.resource
}));

View File

@@ -608,7 +608,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
const droppedResources = extractResources(originalEvent, true);
// Check for dropped external files to be folders
return this.fileService.resolveFiles(droppedResources).then(result => {
return this.fileService.resolveAll(droppedResources).then(result => {
// Pass focus to window
this.windowService.focusWindow();
@@ -649,7 +649,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
if (resources && resources.length > 0) {
// Resolve target to check for name collisions and ask user
return this.fileService.resolveFile(target.resource).then(targetStat => {
return this.fileService.resolve(target.resource).then(targetStat => {
// Check for name collisions
const targetNames = new Set<string>();
@@ -695,7 +695,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
return revertPromise.then(() => {
const copyTarget = joinPath(target.resource, basename(sourceFile));
return this.fileService.copyFile(sourceFile, copyTarget, true).then(stat => {
return this.fileService.copy(sourceFile, copyTarget, true).then(stat => {
// if we only add one file, just open it directly
if (resources.length === 1) {
@@ -794,7 +794,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
// Reuse duplicate action if user copies
if (isCopy) {
return this.fileService.copyFile(source.resource, findValidPasteFileTarget(target, { resource: source.resource, isDirectory: source.isDirectory, allowOverwirte: false })).then(stat => {
return this.fileService.copy(source.resource, findValidPasteFileTarget(target, { resource: source.resource, isDirectory: source.isDirectory, allowOverwirte: false })).then(stat => {
if (!stat.isDirectory) {
return this.editorService.openEditor({ resource: stat.resource, options: { pinned: true } }).then(() => undefined);
}