Skip to content

Commit

Permalink
Add ability to clear checked files
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas authored and Thomas committed Sep 28, 2024
1 parent 10e9e55 commit 5b5ec36
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/.vscode-test.*
node_modules/**
out/**/*.map
!node_modules/ignore/**
Binary file removed files2prompt-icon.png
Binary file not shown.
Binary file added files2prompt-icon.webp
Binary file not shown.
38 changes: 30 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "files2prompt",
"displayName": "Files2Prompt",
"icon": "./files2prompt-icon.png",
"icon": "./files2prompt-icon.webp",
"description": "Copy file contents in XML format for LLM prompts.",
"version": "1.0.1",
"version": "1.1.0",
"publisher": "thomas-mckanna",
"repository": {
"type": "git",
Expand All @@ -15,7 +15,9 @@
"categories": [
"Other"
],
"activationEvents": [],
"activationEvents": [
"onView.files2prompView"
],
"main": "./out/extension.js",
"contributes": {
"viewsContainers": {
Expand All @@ -30,7 +32,7 @@
"views": {
"files2prompt": [
{
"id": "files2promptView",
"id": "files2PromptView",
"name": "Files"
}
]
Expand All @@ -51,19 +53,32 @@
"light": "resources/light/copy.svg",
"dark": "resources/dark/copy.svg"
}
},
{
"command": "files2prompt.clearChecks",
"title": "Clear All Checks",
"icon": {
"light": "resources/light/clear.svg",
"dark": "resources/dark/clear.svg"
}
}
],
"menus": {
"view/title": [
{
"command": "files2prompt.copyFiles",
"when": "view == files2promptView",
"when": "view == files2PromptView",
"group": "navigation@1"
},
{
"command": "files2prompt.refresh",
"when": "view == files2promptView",
"when": "view == files2PromptView",
"group": "navigation@2"
},
{
"command": "files2prompt.clearChecks",
"when": "view == files2PromptView",
"group": "navigation@3"
}
]
},
Expand All @@ -72,15 +87,22 @@
"command": "files2prompt.refresh",
"key": "ctrl+r",
"mac": "cmd+r",
"when": "files2promptView.active && files2promptView.visible && focusedView == 'files2promptView'",
"when": "files2PromptView.active && files2PromptView.visible && focusedView == 'files2PromptView'",
"title": "Files2Prompt: Refresh"
},
{
"command": "files2prompt.copyFiles",
"key": "ctrl+c",
"mac": "cmd+c",
"when": "files2promptView.active && files2promptView.visible && focusedView == 'files2promptView'",
"when": "files2PromptView.active && files2PromptView.visible && focusedView == 'files2PromptView'",
"title": "Files2Prompt: Copy Files"
},
{
"command": "files2prompt.clearChecks",
"key": "ctrl+shift+c",
"mac": "cmd+shift+c",
"when": "files2PromptView.active && files2PromptView.visible && focusedView == 'files2PromptView'",
"title": "Files2Prompt: Clear All Checks"
}
],
"configuration": {
Expand Down
5 changes: 5 additions & 0 deletions resources/dark/clear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions resources/light/clear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function activate(context: vscode.ExtensionContext) {
const workspaceRoot = workspaceFolders[0].uri.fsPath;
const fileTreeProvider = new FileTreeProvider(workspaceRoot);

const treeView = vscode.window.createTreeView("files2promptView", {
const treeView = vscode.window.createTreeView("files2PromptView", {
treeDataProvider: fileTreeProvider,
manageCheckboxStateManually: true,
});
Expand Down Expand Up @@ -49,6 +49,10 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage(
"File contents copied to clipboard."
);
}),
vscode.commands.registerCommand("files2prompt.clearChecks", () => {
fileTreeProvider.clearChecks();
vscode.window.showInformationMessage("All checks have been cleared.");
})
// Add keybindings if necessary (optional)
);
Expand Down
5 changes: 5 additions & 0 deletions src/fileTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export class FileTreeProvider implements vscode.TreeDataProvider<FileItem> {
this._onDidChangeTreeData.fire();
}

clearChecks(): void {
this.checkedItems.clear();
this.refresh();
}

getTreeItem(element: FileItem): vscode.TreeItem {
return element;
}
Expand Down

0 comments on commit 5b5ec36

Please sign in to comment.