mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 13:03:42 +01:00
Fixes issues with create/copy/rename/delete
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
import { commands, Event, EventEmitter, FileStat, FileType, Memento, TextDocumentShowOptions, Uri, ViewColumn } from 'vscode';
|
||||
import { getRootUri, getRelativePath } from './extension';
|
||||
import { getRootUri, getRelativePath, isChild } from './extension';
|
||||
import { sha1 } from './sha1';
|
||||
|
||||
const textDecoder = new TextDecoder();
|
||||
@@ -191,21 +191,29 @@ export class ChangeStore implements IChangeStore, IWritableChangeStore {
|
||||
return entries;
|
||||
}
|
||||
|
||||
const folderPath = getRelativePath(rootUri, uri);
|
||||
|
||||
const operations = this.getChanges(rootUri);
|
||||
for (const operation of operations) {
|
||||
switch (operation.type) {
|
||||
case 'changed':
|
||||
continue;
|
||||
|
||||
case 'created': {
|
||||
const file = getRelativePath(rootUri, operation.uri);
|
||||
entries.push([file, FileType.File]);
|
||||
const filePath = getRelativePath(rootUri, operation.uri);
|
||||
if (isChild(folderPath, filePath)) {
|
||||
entries.push([filePath, FileType.File]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'deleted': {
|
||||
const file = getRelativePath(rootUri, operation.uri);
|
||||
const index = entries.findIndex(([path]) => path === file);
|
||||
if (index !== -1) {
|
||||
entries.splice(index, 1);
|
||||
const filePath = getRelativePath(rootUri, operation.uri);
|
||||
if (isChild(folderPath, filePath)) {
|
||||
const index = entries.findIndex(([path]) => path === filePath);
|
||||
if (index !== -1) {
|
||||
entries.splice(index, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user