feat-filter-ignore #1

Merged
abhishekbhakat merged 9 commits from feat-filter-ignore into main 2025-03-17 07:23:37 +00:00
3 changed files with 44 additions and 16 deletions
Showing only changes of commit 7aece43a6b - Show all commits

View File

@@ -21,7 +21,13 @@
}, },
{ {
"command": "prompter.generatePrompt", "command": "prompter.generatePrompt",
"title": "Copy" "title": "Copy",
"icon": "$(clippy)"
},
{
"command": "prompter.openTreeView",
"title": "Show Tree View",
"icon": "$(list-tree)"
}, },
{ {
"command": "prompter.openSettings", "command": "prompter.openSettings",
@@ -42,7 +48,8 @@
"prompter-sidebar": [ "prompter-sidebar": [
{ {
"id": "prompterView", "id": "prompterView",
"name": "Prompter" "name": "Prompter",
"icon": "resources/icon.svg"
} }
] ]
}, },
@@ -54,9 +61,14 @@
"when": "view == prompterView" "when": "view == prompterView"
}, },
{ {
"command": "prompter.openSettings", "command": "prompter.openTreeView",
"group": "navigation@2", "group": "navigation@2",
"when": "view == prompterView" "when": "view == prompterView"
},
{
"command": "prompter.openSettings",
"group": "navigation@3",
"when": "view == prompterView"
} }
], ],
"view/item/context": [ "view/item/context": [
@@ -95,4 +107,4 @@
"@vscode/vsce": "^3.2.2", "@vscode/vsce": "^3.2.2",
"ignore": "^7.0.3" "ignore": "^7.0.3"
} }
} }

View File

@@ -60,26 +60,33 @@ export function activate(context: vscode.ExtensionContext) {
// Update formatting instructions button text if that setting changed // Update formatting instructions button text if that setting changed
if (item.settingKey === 'includeFormattingInstructions') { if (item.settingKey === 'includeFormattingInstructions') {
xmlEditsButton.text = prompterTreeProvider.isXmlEditsEnabled() ? xmlEditsButton.text = prompterTreeProvider.isXmlEditsEnabled() ?
"$(check) Formatting Instructions" : "$(diff-added) Formatting Instructions"; "$(check) Formatting Instructions" : "$(diff-added) XML Edits";
} }
} }
} }
}); });
// Create formatting instructions toggle button // Create formatting instructions toggle button
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 1);
xmlEditsButton.text = "$(diff-added) Formatting Instructions"; xmlEditsButton.text = "$(diff-added) XML Edits";
xmlEditsButton.tooltip = "Toggle formatting instructions mode"; xmlEditsButton.tooltip = "Toggle formatting instructions mode";
xmlEditsButton.command = 'prompter.toggleXmlEdits'; xmlEditsButton.command = 'prompter.toggleXmlEdits';
xmlEditsButton.show(); xmlEditsButton.show();
// Create copy button // Create copy button
const copyButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right); const copyButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 3);
copyButton.text = "$(clippy) Copy"; copyButton.text = "$(clippy) Copy";
copyButton.tooltip = "Generate and copy prompt"; copyButton.tooltip = "Generate and copy prompt";
copyButton.command = 'prompter.generatePrompt'; copyButton.command = 'prompter.generatePrompt';
copyButton.show(); copyButton.show();
// Create settings button
const settingsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 2);
settingsButton.text = "$(settings-gear)";
settingsButton.tooltip = "Prompter Settings";
settingsButton.command = 'prompter.openSettings';
settingsButton.show();
// Register command to toggle file selection // Register command to toggle file selection
let toggleSelectionCommand = vscode.commands.registerCommand('prompter.toggleSelection', (item: FileTreeItem) => { let toggleSelectionCommand = vscode.commands.registerCommand('prompter.toggleSelection', (item: FileTreeItem) => {
if (item.resourceUri) { if (item.resourceUri) {
@@ -95,13 +102,6 @@ export function activate(context: vscode.ExtensionContext) {
"$(check) XML Edits" : "$(diff-added) XML Edits"; "$(check) XML Edits" : "$(diff-added) XML Edits";
}); });
// Create settings button
const settingsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
settingsButton.text = "$(settings-gear)";
settingsButton.tooltip = "Prompter Settings";
settingsButton.command = 'prompter.openSettings';
settingsButton.show();
// Register command to open settings // Register command to open settings
let openSettingsCommand = vscode.commands.registerCommand('prompter.openSettings', () => { let openSettingsCommand = vscode.commands.registerCommand('prompter.openSettings', () => {
prompterTreeProvider.toggleSettingsView(); prompterTreeProvider.toggleSettingsView();
@@ -113,6 +113,11 @@ export function activate(context: vscode.ExtensionContext) {
"Show Files" : "Prompter Settings"; "Show Files" : "Prompter Settings";
}); });
// Register command to show the tree view
let openTreeViewCommand = vscode.commands.registerCommand('prompter.openTreeView', () => {
prompterTreeProvider.showFilesView();
});
// Register command to generate prompt from selected files // Register command to generate prompt from selected files
let generatePromptCommand = vscode.commands.registerCommand('prompter.generatePrompt', async () => { let generatePromptCommand = vscode.commands.registerCommand('prompter.generatePrompt', async () => {
const selectedFiles = prompterTreeProvider.getSelectedFiles(); const selectedFiles = prompterTreeProvider.getSelectedFiles();
@@ -155,7 +160,8 @@ export function activate(context: vscode.ExtensionContext) {
toggleSelectionCommand, toggleSelectionCommand,
toggleXmlEditsCommand, toggleXmlEditsCommand,
generatePromptCommand, generatePromptCommand,
openSettingsCommand openSettingsCommand,
openTreeViewCommand
); );
} }

View File

@@ -32,6 +32,16 @@ export class PrompterTreeProvider implements vscode.TreeDataProvider<FileTreeIte
this.refresh(); this.refresh();
} }
showSettingsView(): void {
this.showingSettings = true;
this.refresh();
}
showFilesView(): void {
this.showingSettings = false;
this.refresh();
}
getTreeItem(element: FileTreeItem | SettingTreeItem): vscode.TreeItem { getTreeItem(element: FileTreeItem | SettingTreeItem): vscode.TreeItem {
// Return the element as is if it's a SettingTreeItem // Return the element as is if it's a SettingTreeItem
if (element instanceof SettingTreeItem) { if (element instanceof SettingTreeItem) {