From 84099222ce68b0784a79576e1a8906cfb61d3dec Mon Sep 17 00:00:00 2001 From: Sam Pellino Date: Tue, 2 Apr 2024 14:24:55 -0400 Subject: [PATCH] fix: dismiss diff is not working on windows and typo (#146) --- package.json | 8 ++++---- src/constants/commands.ts | 2 +- src/extension.ts | 4 ++-- src/providers/foldersCompareProvider.ts | 6 +++++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 4917b39..08f5dea 100644 --- a/package.json +++ b/package.json @@ -199,7 +199,7 @@ "when": "false" }, { - "command": "foldersCompare.dissmissDifference", + "command": "foldersCompare.dismissDifference", "when": "false" }, { @@ -255,7 +255,7 @@ "group": "1_folderCompares_actions@1" }, { - "command": "foldersCompare.dissmissDifference", + "command": "foldersCompare.dismissDifference", "when": "view == foldersCompareAppService && viewItem == file", "group": "inline" }, @@ -292,8 +292,8 @@ "command": "foldersCompare.deleteFile" }, { - "title": "Dissmiss Difference", - "command": "foldersCompare.dissmissDifference", + "title": "Dismiss Difference", + "command": "foldersCompare.dismissDifference", "icon": "$(close)" }, { diff --git a/src/constants/commands.ts b/src/constants/commands.ts index 327554a..3892d27 100644 --- a/src/constants/commands.ts +++ b/src/constants/commands.ts @@ -12,4 +12,4 @@ export const TAKE_COMPARED_FILE = 'foldersCompare.takeComparedFile'; export const DELETE_FILE = 'foldersCompare.deleteFile'; export const PICK_FROM_RECENT_COMPARES = 'foldersCompare.pickFromRecentCompares'; export const CLEAR_RECENT_COMPARES = 'foldersCompare.clearRecentCompares'; -export const DISSMISS_DIFFERENCE = 'foldersCompare.dissmissDifference'; \ No newline at end of file +export const DISMISS_DIFFERENCE = 'foldersCompare.dismissDifference'; \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index dd778d2..37e614a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,6 +1,6 @@ import { window, commands, ExtensionContext, workspace, Uri, version} from 'vscode'; import { CompareFoldersProvider } from './providers/foldersCompareProvider'; -import { COMPARE_FILES, CHOOSE_FOLDERS_AND_COMPARE, REFRESH, COMPARE_FOLDERS_AGAINST_EACH_OTHER, COMPARE_FOLDERS_AGAINST_WORKSPACE, COMPARE_SELECTED_FOLDERS, SWAP, COPY_TO_COMPARED, COPY_TO_MY, TAKE_MY_FILE, TAKE_COMPARED_FILE, DELETE_FILE, PICK_FROM_RECENT_COMPARES, CLEAR_RECENT_COMPARES, DISSMISS_DIFFERENCE } from './constants/commands'; +import { COMPARE_FILES, CHOOSE_FOLDERS_AND_COMPARE, REFRESH, COMPARE_FOLDERS_AGAINST_EACH_OTHER, COMPARE_FOLDERS_AGAINST_WORKSPACE, COMPARE_SELECTED_FOLDERS, SWAP, COPY_TO_COMPARED, COPY_TO_MY, TAKE_MY_FILE, TAKE_COMPARED_FILE, DELETE_FILE, PICK_FROM_RECENT_COMPARES, CLEAR_RECENT_COMPARES, DISMISS_DIFFERENCE } from './constants/commands'; import { ViewOnlyProvider } from './providers/viewOnlyProvider'; import { globalState } from './services/globalState'; import { pickFromRecents } from './services/pickFromRecentCompares'; @@ -24,7 +24,7 @@ export async function activate(context: ExtensionContext) { commands.registerCommand(COMPARE_FOLDERS_AGAINST_EACH_OTHER, foldersCompareProvider.compareFoldersAgainstEachOther), commands.registerCommand(COMPARE_FOLDERS_AGAINST_WORKSPACE, foldersCompareProvider.chooseFoldersAndCompare), commands.registerCommand(COMPARE_SELECTED_FOLDERS, foldersCompareProvider.compareSelectedFolders), - commands.registerCommand(DISSMISS_DIFFERENCE, foldersCompareProvider.dismissDifference), + commands.registerCommand(DISMISS_DIFFERENCE, foldersCompareProvider.dismissDifference), commands.registerCommand(REFRESH, foldersCompareProvider.refresh), commands.registerCommand(SWAP, foldersCompareProvider.swap), commands.registerCommand(COPY_TO_COMPARED, foldersCompareProvider.copyToCompared), diff --git a/src/providers/foldersCompareProvider.ts b/src/providers/foldersCompareProvider.ts index 3580394..21ee4c6 100644 --- a/src/providers/foldersCompareProvider.ts +++ b/src/providers/foldersCompareProvider.ts @@ -73,10 +73,14 @@ export class CompareFoldersProvider implements TreeDataProvider { }; dismissDifference = async (e: TreeItem) => { - const {path} = e.resourceUri || {}; + const isWindows = process.platform === 'win32'; + let {path} = e.resourceUri || {}; if (!path) { return; } + if(isWindows && e.resourceUri?.scheme){ + path = `${e.resourceUri?.scheme}:${path}`; + } this.ignoreDifferencesList.add(path); this.filterIgnoredFromDiffs(); await this.updateUI();