Skip to content

Commit 060605e

Browse files
committed
fix: add open local folder functionality in list-item
1 parent 8d1ae7d commit 060605e

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/configManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ConfigManager {
5050

5151
// If duplicates were found, update the configuration to remove them.
5252
if (uniqueArray.length !== repository.length) {
53-
this.logger.info(`Removing ${repository.length - uniqueArray.length} duplicate repository URL(s) from configuration`);
53+
this.logger.debug(`Removing ${repository.length - uniqueArray.length} duplicate repository URL(s) from configuration`);
5454

5555
// Update the configuration to persist the deduplicated list.
5656
vscode.workspace.getConfiguration('promptitude')

src/ui/promptCardsWebview.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export class PromptCardsWebviewProvider implements vscode.WebviewViewProvider {
6060
this.logger.debug(`[WebView] openRepository message received for: ${message.repositoryUrl}`);
6161
this.openRepository(message.repositoryUrl);
6262
break;
63+
case 'openLocalFolder':
64+
this.logger.debug(`[WebView] openLocalFolder message received`);
65+
this.openLocalFolder();
66+
break;
6367
default:
6468
this.logger.warn(`[WebView] Unknown message command: ${message.command}`);
6569
}
@@ -158,6 +162,11 @@ export class PromptCardsWebviewProvider implements vscode.WebviewViewProvider {
158162
}
159163
}
160164

165+
private async openLocalFolder() {
166+
// Reuse the existing command from syncManager
167+
await vscode.commands.executeCommand('promptitude.openPromptsFolder');
168+
}
169+
161170
private _getHtmlForWebview(webview: vscode.Webview) {
162171
return `<!DOCTYPE html>
163172
<html lang="en">
@@ -992,19 +1001,21 @@ export class PromptCardsWebviewProvider implements vscode.WebviewViewProvider {
9921001
<span class="type-icon">\${typeIcon}</span>
9931002
\${escapeHtml(cleanPromptName(prompt.name))}
9941003
</h3>
1004+
\${prompt.repositoryUrl ? \`
9951005
<div class="card-actions" onclick="event.stopPropagation()">
9961006
<button class="action-btn \${prompt.active ? 'active-btn' : 'inactive-btn'}" onclick="event.stopPropagation(); togglePrompt('\${escapedPath}'); return false;" title="\${prompt.active ? 'Click to deactivate' : 'Click to activate'}">
9971007
\${prompt.active ? '✓ Activated' : '+ Activate'}
9981008
</button>
9991009
</div>
1010+
\` : ''}
10001011
</div>
10011012
<div class="card-description">
10021013
\${escapeHtml(prompt.description || 'No description available')}
10031014
</div>
10041015
<div class="card-repository" onclick="event.stopPropagation()">
10051016
\${prompt.repositoryUrl ?
10061017
\`📦 <a href="#" onclick="openRepository('\${escapeHtml(prompt.repositoryUrl)}'); return false;" title="Open repository in browser">\${escapeHtml(getRepositoryName(prompt.repositoryUrl))} 🔗</a>\` :
1007-
\`📦 Local\`
1018+
\`💻 <a href="#" onclick="openLocalFolder(); return false;" title="Open local prompts folder">Local</a>\`
10081019
}
10091020
</div>
10101021
</div>
@@ -1093,6 +1104,12 @@ export class PromptCardsWebviewProvider implements vscode.WebviewViewProvider {
10931104
});
10941105
}
10951106
1107+
function openLocalFolder() {
1108+
vscode.postMessage({
1109+
command: 'openLocalFolder'
1110+
});
1111+
}
1112+
10961113
// Request initial data
10971114
vscode.postMessage({ command: 'refresh' });
10981115
</script>

0 commit comments

Comments
 (0)