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",
"title": "Copy"
"title": "Copy",
"icon": "$(clippy)"
},
{
"command": "prompter.openTreeView",
"title": "Show Tree View",
"icon": "$(list-tree)"
},
{
"command": "prompter.openSettings",
@@ -42,7 +48,8 @@
"prompter-sidebar": [
{
"id": "prompterView",
"name": "Prompter"
"name": "Prompter",
"icon": "resources/icon.svg"
}
]
},
@@ -54,9 +61,14 @@
"when": "view == prompterView"
},
{
"command": "prompter.openSettings",
"command": "prompter.openTreeView",
"group": "navigation@2",
"when": "view == prompterView"
},
{
"command": "prompter.openSettings",
"group": "navigation@3",
"when": "view == prompterView"
}
],
"view/item/context": [

View File

@@ -60,26 +60,33 @@ export function activate(context: vscode.ExtensionContext) {
// Update formatting instructions button text if that setting changed
if (item.settingKey === 'includeFormattingInstructions') {
xmlEditsButton.text = prompterTreeProvider.isXmlEditsEnabled() ?
"$(check) Formatting Instructions" : "$(diff-added) Formatting Instructions";
"$(check) Formatting Instructions" : "$(diff-added) XML Edits";
}
}
}
});
// Create formatting instructions toggle button
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
xmlEditsButton.text = "$(diff-added) Formatting Instructions";
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 1);
xmlEditsButton.text = "$(diff-added) XML Edits";
xmlEditsButton.tooltip = "Toggle formatting instructions mode";
xmlEditsButton.command = 'prompter.toggleXmlEdits';
xmlEditsButton.show();
// 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.tooltip = "Generate and copy prompt";
copyButton.command = 'prompter.generatePrompt';
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
let toggleSelectionCommand = vscode.commands.registerCommand('prompter.toggleSelection', (item: FileTreeItem) => {
if (item.resourceUri) {
@@ -95,13 +102,6 @@ export function activate(context: vscode.ExtensionContext) {
"$(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
let openSettingsCommand = vscode.commands.registerCommand('prompter.openSettings', () => {
prompterTreeProvider.toggleSettingsView();
@@ -113,6 +113,11 @@ export function activate(context: vscode.ExtensionContext) {
"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
let generatePromptCommand = vscode.commands.registerCommand('prompter.generatePrompt', async () => {
const selectedFiles = prompterTreeProvider.getSelectedFiles();
@@ -155,7 +160,8 @@ export function activate(context: vscode.ExtensionContext) {
toggleSelectionCommand,
toggleXmlEditsCommand,
generatePromptCommand,
openSettingsCommand
openSettingsCommand,
openTreeViewCommand
);
}

View File

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