Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-05-02 - Actionable Empty States
**Learning:** Empty states present an opportunity to lower user friction when a search yields zero results. Providing a "Clear Search" or "Switch Scope" directly in the empty state acts as an actionable recovery path, so users don't have to manually clear the input field or change settings themselves.
**Action:** When designing or refactoring empty state components, always provide an inline action button (such as "Clear Search", "Reset Filters", or "Back to Global Scope") directly within the empty state context to simplify recovery.
30 changes: 26 additions & 4 deletions vscode-extension/src/search-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class SearchProvider {
private readonly TOOLTIP_REVEAL = 'Reveal in File Explorer';

// Command IDs for empty state actions
private readonly CMD_CLEAR_SEARCH = 'command:clear-search';
private readonly CMD_NATIVE_SEARCH = 'command:native-search';
private readonly CMD_SWITCH_SCOPE = 'command:switch-scope-everything';
private readonly CMD_REBUILD_INDEX = 'command:rebuild-index';
Expand Down Expand Up @@ -1530,6 +1531,19 @@ export class SearchProvider {
selected: SearchResultItem,
quickPick: vscode.QuickPick<SearchResultItem>,
): Promise<boolean> {
if (selected.result.item.id === this.CMD_CLEAR_SEARCH) {
quickPick.value = '';
// Programmatically changing QuickPick.value does not fire onDidChangeValue in VS Code
// We must manually trigger the query change logic to update the list
this.handleQueryChange(
quickPick,
'',
() => {},
() => {},
);
return true;
}

if (selected.result.item.id === this.CMD_NATIVE_SEARCH) {
await vscode.commands.executeCommand('workbench.action.findInFiles', {
query: quickPick.value,
Expand Down Expand Up @@ -1656,21 +1670,29 @@ export class SearchProvider {
});
};

// 3. Native Search Action
// 3. Clear Search Action
addCommandItem(
'Clear Search',
'Reset your search query',
new vscode.ThemeIcon('clear-all'),
this.CMD_CLEAR_SEARCH,
);

// 4. Native Search Action
addCommandItem(
'Search in Files (Native)',
"Use VS Code's native search",
new vscode.ThemeIcon('search-fuzzy'),
this.CMD_NATIVE_SEARCH,
);

// 4. Rebuild Index Action
// 5. Rebuild Index Action
addCommandItem('Rebuild Index', 'Fix missing files', new vscode.ThemeIcon('refresh'), this.CMD_REBUILD_INDEX);

// 5. Clear Cache Action
// 6. Clear Cache Action
addCommandItem('Clear Index Cache', 'Fix corruption', new vscode.ThemeIcon('trash'), this.CMD_CLEAR_CACHE);

// 6. Settings Action
// 7. Settings Action
addCommandItem(
'Configure Settings',
'Check exclusion rules',
Expand Down
Loading