Skip to content
Open
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 @@
## 2024-05-09 - Providing Actionable Recovery Paths in Empty States
**Learning:** When users encounter an empty search state, simply showing a "No results" message creates friction, forcing them to manually clear the input to try again. By providing an actionable recovery path directly within the empty state container (like a 'Clear Search' button), the interface becomes much more intuitive and reduces the number of interactions required to recover from a failed search.
**Action:** When designing empty states in the UI (e.g., no search results, empty lists), always provide an actionable recovery path directly within the empty state container to reduce interaction friction.
21 changes: 18 additions & 3 deletions vscode-extension/src/search-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class SearchProvider {
private readonly CMD_SWITCH_SCOPE = 'command:switch-scope-everything';
private readonly CMD_REBUILD_INDEX = 'command:rebuild-index';
private readonly CMD_CLEAR_CACHE = 'command:clear-cache';
private readonly CMD_CLEAR_SEARCH = 'command:clear-search';
private readonly CMD_SETTINGS = 'command:open-settings';
private readonly ID_EMPTY_STATE = 'empty-state';

Expand Down Expand Up @@ -1578,6 +1579,17 @@ export class SearchProvider {
return true;
}

if (selected.result.item.id === this.CMD_CLEAR_SEARCH) {
quickPick.value = '';
this.handleQueryChange(
quickPick,
'',
() => {},
() => {},
);
return true;
}

return selected.result.item.id === this.ID_EMPTY_STATE;
}

Expand Down Expand Up @@ -1662,13 +1674,16 @@ export class SearchProvider {
this.CMD_NATIVE_SEARCH,
);

// 4. Rebuild Index Action
// 4. Clear Search Action
addCommandItem('Clear Search', 'Start a new search', new vscode.ThemeIcon('clear-all'), this.CMD_CLEAR_SEARCH);

// 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
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export const variable = 42;
if (args && args.length >= 3 && Array.isArray(args[2])) {
const locations = args[2];
const hasDeclaration = locations.some(
(loc: any) =>
(loc: vscode.Location) =>
loc.uri.toString() === mockDocument.uri.toString() &&
loc.range.isEqual(lenses[0].range),
);
Expand Down
Loading