diff --git a/src/vs/base/common/map.ts b/src/vs/base/common/map.ts index 7563aa5b98da1be5f940121fa83f2dba78c8e78b..09c03b971b0996d34e8317059c3f5d79d7ffed3c 100644 --- a/src/vs/base/common/map.ts +++ b/src/vs/base/common/map.ts @@ -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 { } 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(); } diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 4f63834ebe7862ffc4cc072c26332f28f6789af4..073ab8d7d9fa96663a05b97a31dc66b40c0e6d2e 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -572,7 +572,6 @@ export class VSCodeWindow { } let background = this.storageService.getItem(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 diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts index c6f8cc22422eb798f3f8e909c5d3734dc57b002a..e7cb33774ac7a7597f16d7413bb4d5b1f96764c4 100644 --- a/src/vs/workbench/browser/labels.ts +++ b/src/vs/workbench/browser/labels.ts @@ -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) { diff --git a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts index 5960046face128e55240a24253cad7c67d0ef249..5ff0267140de8333ca3fd26d02d66da05a3a05cd 100644 --- a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts @@ -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 diff --git a/src/vs/workbench/parts/files/browser/fileActions.contribution.ts b/src/vs/workbench/parts/files/browser/fileActions.contribution.ts index ef60615a0292faacb3170824a6356ab8590ce406..7c3bd0125d2d2286542716867d0d209f606b0a37 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.contribution.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.contribution.ts @@ -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) { diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts index 815d2be4570b7e6953d8e706276b8c240e086126..e8beea1288fa842578a6d396257c43fb4e08bd23 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.ts @@ -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(); } } diff --git a/src/vs/workbench/parts/files/browser/views/explorerView.ts b/src/vs/workbench/parts/files/browser/views/explorerView.ts index 277acb543abbae28876b731bf594210311dd1c71..684c966b2615e2a818277975d042dac934f916e7 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerView.ts @@ -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 { // 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; diff --git a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts index 3d24249410cf75c18507815ff6ba78b532f81e4a..4494835dff88f1a34a596c8b52c8d233930aa1c5 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts @@ -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; } diff --git a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts index 7c0df2e2875d5a99a783657639f6052294c72f02..8fee6c2d8b24d84d65b73a36dd62a1ee007d681a 100644 --- a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts @@ -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; diff --git a/src/vs/workbench/parts/files/common/explorerViewModel.ts b/src/vs/workbench/parts/files/common/explorerViewModel.ts index df308c44db13e87dd854b3783b669c07c524630d..64b3abbe18f7947176b72ff18e2d9b88872e673e 100644 --- a/src/vs/workbench/parts/files/common/explorerViewModel.ts +++ b/src/vs/workbench/parts/files/common/explorerViewModel.ts @@ -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; } diff --git a/src/vs/workbench/parts/markers/browser/markersPanel.ts b/src/vs/workbench/parts/markers/browser/markersPanel.ts index ba408f9a445d65834af2b4171c6de19b94773456..deafb8d19be3f6d16a6d6ee00f0db585e45a328b 100644 --- a/src/vs/workbench/parts/markers/browser/markersPanel.ts +++ b/src/vs/workbench/parts/markers/browser/markersPanel.ts @@ -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; } } diff --git a/src/vs/workbench/parts/search/browser/searchViewlet.ts b/src/vs/workbench/parts/search/browser/searchViewlet.ts index 12122f10a2a01a9007ab145c42eb6b77d7323d80..daf2ae88b55779d1a44328035a7724d96e7c5b4a 100644 --- a/src/vs/workbench/parts/search/browser/searchViewlet.ts +++ b/src/vs/workbench/parts/search/browser/searchViewlet.ts @@ -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; diff --git a/src/vs/workbench/parts/search/test/browser/searchActions.test.ts b/src/vs/workbench/parts/search/test/browser/searchActions.test.ts index e9bd0455676b0ac2f4d380b67d82e694bcb78eec..705560719d8c11b13373ca92ddc7347089f94694 100644 --- a/src/vs/workbench/parts/search/test/browser/searchActions.test.ts +++ b/src/vs/workbench/parts/search/test/browser/searchActions.test.ts @@ -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; }); diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index 33bca74408718a1f90ebe43a9718077640a95ba3..435e0dea1d72d7e54084ce3ad3381def850a894f 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -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; } } diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index a3a7bead6a0bb1373bd0dfe511be73205903e391..47074728c5df166e47929c5a972ef2e14056130e 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -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)[] {