Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ In bigger projects with many files it also provides **context**, it gives you a

- Log output of all git commands run

- Search within changed files (Git Tree Comparse: Search Changes)

## Location

By default, the tree view is located in its own container accessible from the activity bar on the left. However, it can be freely moved to any other location like Source Control or Explorer by dragging and dropping.
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@
"title": "View as Tree",
"icon": "$(list-tree)",
"category": "Git Tree Compare"
},
{
"command": "gitTreeCompare.searchChanges",
"title": "Search Changes",
"icon": "$(search)",
"category": "Git Tree Compare"
}
],
"menus": {
Expand Down Expand Up @@ -220,6 +226,11 @@
"command": "gitTreeCompare.viewAsTree",
"when": "view == gitTreeCompare && gitTreeCompare.viewAsList",
"group": "navigation@1"
},
{
"command": "gitTreeCompare.searchChanges",
"when": "view == gitTreeCompare",
"group": "2_files"
}
],
"view/item/context": [
Expand Down
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export function activate(context: ExtensionContext) {
commands.registerCommand(NAMESPACE + '.viewAsTree', () => {
runAfterInit(() => provider!.viewAsTree(true));
});
commands.registerCommand(NAMESPACE + '.searchChanges', () => {
runAfterInit(() => provider!.searchChanges());
});

createGit(gitApi, outputChannel).then(async git => {
const onOutput = (str: string) => outputChannel.append(str);
Expand Down
10 changes: 10 additions & 0 deletions src/treeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,16 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
this._onDidChangeTreeData.fire();
}

async searchChanges() {
const uris = [...this.iterFiles()].map(file => Uri.file(file.dstAbsPath));
const relativePaths = uris.map(uri => path.relative(this.repoRoot, uri.fsPath));
await commands.executeCommand('workbench.action.findInFiles', {
query: '',
filesToInclude: relativePaths.join(','),
triggerSearch: true
});
}

dispose(): void {
this.disposables.forEach(d => d.dispose());
}
Expand Down
Loading