提交 67cf0074 编写于 作者: B Benjamin Pasero

File from UNC-folders twice time opened in same instance after changes (fixes #24003)

上级 91334c8e
......@@ -6,7 +6,6 @@
'use strict';
import URI from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
export interface Key {
toString(): string;
......@@ -450,14 +449,7 @@ export class ResourceMap<T> {
}
private toKey(resource: URI): string {
let key: string;
if (resource.scheme === Schemas.file) {
key = resource.fsPath;
} else {
key = resource.toString();
}
let key = resource.toString();
if (this.ignoreCase) {
key = key.toLowerCase();
}
......
......@@ -572,7 +572,6 @@ export class VSCodeWindow {
}
let background = this.storageService.getItem<string>(VSCodeWindow.themeBackgroundStorageKey, null);
console.log('itm ' + background);
if (!background) {
let baseTheme = this.getBaseTheme();
return baseTheme === 'hc-black' ? '#000000' : (baseTheme === 'vs' ? '#FFFFFF' : (platform.isMacintosh ? '#171717' : '#1E1E1E')); // https://github.com/electron/electron/issues/5150
......
......@@ -73,7 +73,7 @@ export class ResourceLabel extends IconLabel {
const oldResource = this.label ? this.label.resource : void 0;
if (newResource && oldResource) {
return newResource.fsPath !== oldResource.fsPath;
return newResource.toString() !== oldResource.toString();
}
if (!newResource && !oldResource) {
......
......@@ -19,7 +19,7 @@ import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel'
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
import { ExplorerViewlet } from 'vs/workbench/parts/files/browser/explorerViewlet';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IFileOperationResult, FileOperationResult, FileChangesEvent, IFileService, isEqual } from 'vs/platform/files/common/files';
import { IFileOperationResult, FileOperationResult, FileChangesEvent, IFileService } from 'vs/platform/files/common/files';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
......@@ -123,7 +123,7 @@ export class TextFileEditor extends BaseTextEditor {
const hasInput = !!this.input;
const modelDisposed = textFileModel.isDisposed();
const inputChanged = hasInput && !isEqual(this.input.getResource().fsPath, textFileModel.getResource().fsPath);
const inputChanged = hasInput && this.input.getResource().toString() !== textFileModel.getResource().toString();
if (
!hasInput || // editor got hidden meanwhile
modelDisposed || // input got disposed meanwhile
......
......@@ -25,7 +25,6 @@ import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/c
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { explorerItemToFileResource, ExplorerFocusCondition, FilesExplorerFocusCondition } from 'vs/workbench/parts/files/common/files';
import { isEqual } from 'vs/platform/files/common/files';
class FilesViewerActionContributor extends ActionBarContributor {
......@@ -88,7 +87,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
}
const workspace = this.contextService.getWorkspace();
const isRoot = workspace && isEqual(stat.resource.fsPath, workspace.resource.fsPath);
const isRoot = workspace && stat.resource.toString() === workspace.resource.toString();
// Copy File/Folder
if (!isRoot) {
......
......@@ -963,7 +963,7 @@ export class PasteFileAction extends BaseFileAction {
// Find target
let target: FileStat;
if (isEqual(this.element.resource.fsPath, fileToCopy.resource.fsPath)) {
if (this.element.resource.toString() === fileToCopy.resource.toString()) {
target = this.element.parent;
} else {
target = this.element.isDirectory ? this.element : this.element.parent;
......@@ -1270,7 +1270,7 @@ export class CompareResourcesAction extends Action {
}
// Check if target is identical to source
if (isEqual(this.resource.fsPath, globalResourceToCompare.fsPath)) {
if (this.resource.toString() === globalResourceToCompare.toString()) {
return false;
}
......@@ -1365,7 +1365,7 @@ export abstract class BaseSaveFileAction extends BaseActionWithErrorReporting {
const editor = getCodeEditor(activeEditor);
if (editor) {
const activeResource = toResource(activeEditor.input, { supportSideBySide: true, filter: ['file', 'untitled'] });
if (activeResource && isEqual(activeResource.fsPath, source.fsPath)) {
if (activeResource && activeResource.toString() === source.toString()) {
viewStateOfSource = editor.saveViewState();
}
}
......
......@@ -17,7 +17,7 @@ import { prepareActions } from 'vs/workbench/browser/actionBarRegistry';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { IFilesConfiguration, ExplorerFolderContext, FilesExplorerFocussedContext, ExplorerFocussedContext } from 'vs/workbench/parts/files/common/files';
import { FileOperation, FileOperationEvent, IResolveFileOptions, FileChangeType, FileChangesEvent, IFileChange, IFileService, isEqual, isEqualOrParent } from 'vs/platform/files/common/files';
import { FileOperation, FileOperationEvent, IResolveFileOptions, FileChangeType, FileChangesEvent, IFileChange, IFileService, isEqualOrParent } from 'vs/platform/files/common/files';
import { RefreshViewExplorerAction, NewFolderAction, NewFileAction } from 'vs/workbench/parts/files/browser/fileActions';
import { FileDragAndDrop, FileFilter, FileSorter, FileController, FileRenderer, FileDataSource, FileViewletState, FileAccessibilityProvider } from 'vs/workbench/parts/files/browser/views/explorerViewer';
import { toResource } from 'vs/workbench/common/editor';
......@@ -440,12 +440,12 @@ export class ExplorerView extends CollapsibleViewletView {
// Only update focus if renamed/moved element is selected
let restoreFocus = false;
const focus: FileStat = this.explorerViewer.getFocus();
if (focus && focus.resource && isEqual(focus.resource.fsPath, oldResource.fsPath)) {
if (focus && focus.resource && focus.resource.toString() === oldResource.toString()) {
restoreFocus = true;
}
// Handle Rename
if (oldParentResource && newParentResource && isEqual(oldParentResource.fsPath, newParentResource.fsPath)) {
if (oldParentResource && newParentResource && oldParentResource.toString() === newParentResource.toString()) {
modelElement = this.root.find(oldResource);
if (modelElement) {
......@@ -729,7 +729,7 @@ export class ExplorerView extends CollapsibleViewletView {
*/
private getResolvedDirectories(stat: FileStat, resolvedDirectories: URI[]): void {
if (stat.isDirectoryResolved) {
if (!isEqual(stat.resource.fsPath, this.contextService.getWorkspace().resource.fsPath)) {
if (stat.resource.toString() !== this.contextService.getWorkspace().resource.toString()) {
// Drop those path which are parents of the current one
for (let i = resolvedDirectories.length - 1; i >= 0; i--) {
......@@ -758,7 +758,7 @@ export class ExplorerView extends CollapsibleViewletView {
public select(resource: URI, reveal: boolean = this.autoReveal): TPromise<void> {
// Require valid path
if (!resource || isEqual(resource.fsPath, this.contextService.getWorkspace().resource.fsPath)) {
if (!resource || resource.toString() === this.contextService.getWorkspace().resource.toString()) {
return TPromise.as(null);
}
......@@ -798,7 +798,7 @@ export class ExplorerView extends CollapsibleViewletView {
const currentSelection: FileStat[] = this.explorerViewer.getSelection();
for (let i = 0; i < currentSelection.length; i++) {
if (isEqual(currentSelection[i].resource.fsPath, resource.fsPath)) {
if (currentSelection[i].resource.toString() === resource.toString()) {
return currentSelection[i];
}
}
......@@ -842,7 +842,7 @@ export class ExplorerView extends CollapsibleViewletView {
// Keep list of expanded folders to restore on next load
if (this.root) {
const expanded = this.explorerViewer.getExpandedElements()
.filter((e: FileStat) => !isEqual(e.resource.fsPath, this.contextService.getWorkspace().resource.fsPath))
.filter((e: FileStat) => e.resource.toString() !== this.contextService.getWorkspace().resource.toString())
.map((e: FileStat) => e.resource.toString());
this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES] = expanded;
......
......@@ -112,7 +112,7 @@ export class FileDataSource implements IDataSource {
// Return if root reached
const workspace = this.contextService.getWorkspace();
if (workspace && isEqual(stat.resource.fsPath, workspace.resource.fsPath)) {
if (workspace && stat.resource.toString() === workspace.resource.toString()) {
return TPromise.as(null);
}
......@@ -424,7 +424,7 @@ export class FileController extends DefaultController {
// Handle root
const workspace = this.contextService.getWorkspace();
if (workspace && isEqual(stat.resource.fsPath, workspace.resource.fsPath)) {
if (workspace && stat.resource.toString() === workspace.resource.toString()) {
tree.clearFocus(payload);
tree.clearSelection(payload);
......@@ -699,7 +699,7 @@ export class FileDragAndDrop implements IDragAndDrop {
return true; // NewStatPlaceholders can not be moved
}
if (isEqual(source.resource.fsPath, target.resource.fsPath)) {
if (source.resource.toString() === target.resource.toString()) {
return true; // Can not move anything onto itself
}
......@@ -723,7 +723,7 @@ export class FileDragAndDrop implements IDragAndDrop {
}
const workspace = this.contextService.getWorkspace();
if (workspace && !isEqual(target.resource.fsPath, workspace.resource.fsPath)) {
if (workspace && target.resource.toString() !== workspace.resource.toString()) {
return fromDesktop || isCopy ? DRAG_OVER_ACCEPT_BUBBLE_UP_COPY : DRAG_OVER_ACCEPT_BUBBLE_UP;
}
......
......@@ -12,7 +12,7 @@ import URI from 'vs/base/common/uri';
import { EncodingMode, ConfirmResult, EditorInput, IFileEditorInput } from 'vs/workbench/common/editor';
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
import { IFileOperationResult, FileOperationResult, isEqual } from 'vs/platform/files/common/files';
import { IFileOperationResult, FileOperationResult } from 'vs/platform/files/common/files';
import { BINARY_FILE_EDITOR_ID, TEXT_FILE_EDITOR_ID, FILE_EDITOR_INPUT_ID } from 'vs/workbench/parts/files/common/files';
import { ITextFileService, AutoSaveMode, ModelState, TextFileModelChangeEvent } from 'vs/workbench/services/textfile/common/textfiles';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
......@@ -75,13 +75,13 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
}
private onDirtyStateChange(e: TextFileModelChangeEvent): void {
if (isEqual(e.resource.fsPath, this.resource.fsPath)) {
if (e.resource.toString() === this.resource.toString()) {
this._onDidChangeDirty.fire();
}
}
private onModelOrphanedChanged(e: TextFileModelChangeEvent): void {
if (isEqual(e.resource.fsPath, this.resource.fsPath)) {
if (e.resource.toString() === this.resource.toString()) {
this._onDidChangeLabel.fire();
}
}
......@@ -265,7 +265,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
}
if (otherInput) {
return otherInput instanceof FileEditorInput && isEqual(otherInput.resource.fsPath, this.resource.fsPath);
return otherInput instanceof FileEditorInput && otherInput.resource.toString() === this.resource.toString();
}
return false;
......
......@@ -85,7 +85,7 @@ export class FileStat implements IFileStat {
* exists locally.
*/
public static mergeLocalWithDisk(disk: FileStat, local: FileStat): void {
if (!isEqual(disk.resource.fsPath, local.resource.fsPath)) {
if (disk.resource.toString() !== local.resource.toString()) {
return; // Merging only supported for stats with the same resource
}
......@@ -180,7 +180,7 @@ export class FileStat implements IFileStat {
*/
public removeChild(child: FileStat): void {
for (let i = 0; i < this.children.length; i++) {
if (isEqual(this.children[i].resource.fsPath, child.resource.fsPath)) {
if (this.children[i].resource.toString() === child.resource.toString()) {
this.children.splice(i, 1);
break;
}
......
......@@ -36,7 +36,6 @@ import { ContributableActionProvider } from 'vs/workbench/browser/actionBarRegis
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IListService } from 'vs/platform/list/browser/listService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { isEqual } from 'vs/platform/files/common/files';
export class MarkersPanel extends Panel {
......@@ -345,7 +344,7 @@ export class MarkersPanel extends Panel {
let selectedElement = this.tree.getSelection();
if (selectedElement && selectedElement.length > 0) {
if (selectedElement[0] instanceof Marker) {
if (isEqual(resource.uri, selectedElement[0].marker.resource)) {
if (resource.uri.toString() === selectedElement[0].marker.resource.toString()) {
return true;
}
}
......
......@@ -30,7 +30,7 @@ import { Scope } from 'vs/workbench/common/memento';
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { getOutOfWorkspaceEditorResources } from 'vs/workbench/common/editor';
import { FileChangeType, FileChangesEvent, IFileService, isEqual } from 'vs/platform/files/common/files';
import { FileChangeType, FileChangesEvent, IFileService } from 'vs/platform/files/common/files';
import { Viewlet } from 'vs/workbench/browser/viewlet';
import { Match, FileMatch, SearchModel, FileMatchOrMatch, IChangeEvent, ISearchWorkbenchService } from 'vs/workbench/parts/search/common/searchModel';
import { QueryBuilder } from 'vs/workbench/parts/search/common/searchQuery';
......@@ -914,7 +914,7 @@ export class SearchViewlet extends Viewlet {
return;
}
if (isEqual(workspace.resource.fsPath, resource.fsPath)) {
if (workspace.resource.toString() === resource.toString()) {
this.inputPatternIncludes.setValue('');
this.searchWidget.focus();
return;
......
......@@ -31,6 +31,7 @@ suite('Search Actions', () => {
instantiationService.stub(IModelService, stubModelService(instantiationService));
instantiationService.stub(IKeybindingService, {});
instantiationService.stub(IKeybindingService, 'resolveKeybinding', (keybinding: Keybinding) => [new USLayoutResolvedKeybinding(keybinding, OS)]);
instantiationService.stub(IKeybindingService, 'lookupKeybinding', (id: string) => null);
counter = 0;
});
......
......@@ -601,7 +601,7 @@ export class FileService implements IFileService {
// check if the resource is a child of the resource with override and use
// the provided encoding in that case
if (isParent(resource.fsPath, override.resource.fsPath)) {
if (isParent(resource.fsPath, override.resource.fsPath, !isLinux /* ignorecase */)) {
return override.encoding;
}
}
......
......@@ -14,7 +14,7 @@ import { IEditor as IBaseEditor, IEditorInput, ITextEditorOptions, IResourceInpu
import { EditorInput, IGroupEvent, IEditorRegistry, Extensions, toResource, IEditorGroup } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { FileChangesEvent, IFileService, FileChangeType, isEqual } from 'vs/platform/files/common/files';
import { FileChangesEvent, IFileService, FileChangeType } from 'vs/platform/files/common/files';
import { Selection } from 'vs/editor/common/core/selection';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
......@@ -590,12 +590,12 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
if (arg2 instanceof EditorInput) {
const file = toResource(arg2, { filter: 'file' });
return file && isEqual(file.fsPath, resource.fsPath);
return file && file.toString() === resource.toString();
}
const resourceInput = arg2 as IResourceInput;
return resourceInput && isEqual(resourceInput.resource.fsPath, resource.fsPath);
return resourceInput && resourceInput.resource.toString() === resource.toString();
}
public getHistory(): (IEditorInput | IResourceInput)[] {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册