Skip to content

Commit

Permalink
Switch left and right (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
llgcode authored Mar 16, 2020
1 parent 6a151b9 commit 6209647
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Change log

**0.8.0**

Allow the change diff view's sides ([#21](https://github.com/moshfeu/vscode-compare-folders/issues/21))

**0.7.0**

Added the ability to ignore files names' case when comparing ([#23](https://github.com/moshfeu/vscode-compare-folders/issues/23))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The extension allows the user to compare folders, show the diffs in a list and p
- `compareContent` - boolean - Compares files by content
- `diffViewTitle` - One of the options: "name only", "compared path", "full path"
- `ignoreFileNameCase` - boolean - Compare files with the same name but different case
- `diffLayout` - One of the options: "local <> compared" or "compared <> local"

**Example**

Expand Down
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "compare-folders",
"displayName": "Compare Folders",
"description": "Compare folders by contents, present the files that have differences and display the diffs side by side",
"version": "0.7.0",
"version": "0.8.0",
"repository": {
"type": "git",
"url": "https://github.com/moshfeu/vscode-compare-folders"
Expand Down Expand Up @@ -76,6 +76,20 @@
],
"markdownDescription": "Specifies how the diff view's title look like",
"scope": "window"
},
"compareFolders.diffLayout": {
"type": "string",
"default": "local <> compared",
"enum": [
"local <> compared",
"compared <> local"
],
"enumDescriptions": [
"eg. left: local file, right: compared file",
"eg. left: compared file, right: local file"
],
"markdownDescription": "Specifies which file will be in the left and the right sides of the diff view",
"scope": "window"
}
}
},
Expand Down
14 changes: 4 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import { window, commands, Disposable, env, Uri } from 'vscode';
import { window, commands, ExtensionContext} from 'vscode';
import { CompareFoldersProvider } from './providers/foldersCompareProvider';
import { COMPARE_FILES, CHOOSE_FOLDERS_AND_COMPARE, REFRESH } from './constants/commands';
import { ViewOnlyProvider } from './providers/viewOnlyProvider';

const disposables: Disposable[] = [];
export function activate() {

export function activate(context: ExtensionContext) {
const onlyInA = new ViewOnlyProvider();
const onlyInB = new ViewOnlyProvider();
const foldersCompareProvider = new CompareFoldersProvider(onlyInA, onlyInB);

disposables.push(
...[
context.subscriptions.push(
window.registerTreeDataProvider('foldersCompareAppService', foldersCompareProvider),
window.registerTreeDataProvider('foldersCompareAppServiceOnlyA', onlyInA),
window.registerTreeDataProvider('foldersCompareAppServiceOnlyB', onlyInB),
commands.registerCommand(COMPARE_FILES, foldersCompareProvider.onFileClicked),
commands.registerCommand(CHOOSE_FOLDERS_AND_COMPARE, foldersCompareProvider.chooseFoldersAndCompare),
commands.registerCommand(REFRESH, foldersCompareProvider.refresh),
]
);
}

export function deactivate() {
disposables.forEach(disposable => disposable.dispose());
}
6 changes: 5 additions & 1 deletion src/providers/foldersCompareProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ export class CompareFoldersProvider implements TreeDataProvider<File> {
onFileClicked([path1, path2]: [string, string], title: string) {
try {
if (path2) {
showDiffs([path1, path2], title);
let diffs: [string, string] = [path2, path1];
if (getConfiguration('diffLayout').diffLayout === 'local <> compared') {
diffs = [path1, path2];
}
showDiffs(diffs, title);
} else {
showFile(path1, title);
}
Expand Down
1 change: 1 addition & 0 deletions src/services/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface IConfigurations {
excludeFilter: string[] | undefined;
includeFilter: string[] | undefined;
diffViewTitle: 'name only' | 'compared path' | 'full path';
diffLayout: 'local <> compared' | 'compared <> local';
ignoreFileNameCase: boolean;
}

Expand Down

0 comments on commit 6209647

Please sign in to comment.