Skip to content

Commit 651a143

Browse files
committed
Remember the last selected agent in agentic search and format repeated action progress dots with spacing
- highlight last used agent - after '...' place space before placing further dots, e.g. 'run command.....' -> 'run command... ..' └── apps └── editor └── src ├── constants │ └── state-keys.ts └── features └── search-files ├── index.ts ├── search-files.ts ├── search-modes │ ├── perform-agent-search-mode │ │ ├── agents │ │ │ ├── antigravity.ts │ │ │ ├── claude.ts │ │ │ ├── codex.ts │ │ │ ├── cursor.ts │ │ │ ├── grok.ts │ │ │ ├── muse.ts │ │ │ └── opencode.ts │ │ ├── index.ts │ │ ├── perform-agent-search-mode.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── perform-intelligent-search-mode.ts │ ├── perform-keywords-search-mode.ts │ └── perform-phrase-search-mode.ts └── utils ├── analyze-files.ts ├── check-matches-condition.ts ├── create-search-regex.ts ├── group-quick-pick-items.ts ├── handle-parent-folder-result.ts ├── map-files-to-quick-pick-items.ts ├── prompt-for-config.ts ├── prompt-for-intelligent-search-results.ts ├── prompt-for-keywords-match-mode.ts ├── prompt-for-keywords-target.ts ├── prompt-for-search-mode.ts ├── prompt-for-search-results.ts ├── prompt-for-search-term.ts ├── prompt-for-shrink-mode.ts ├── search-files-by-intelligent.ts ├── search-files-by-keywords.ts ├── search-files-by-phrase.ts └── show-search-results-quick-pick.ts
1 parent 4bec80c commit 651a143

6 files changed

Lines changed: 33 additions & 5 deletions

File tree

‎apps/editor/src/constants/state-keys.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export const LAST_SEARCH_SELECTED_FILES_FOR_CONTEXT_MODE_STATE_KEY =
8686

8787
export const LAST_SELECTED_WORKSPACE_IN_AGENT_SEARCH_STATE_KEY =
8888
'last-selected-workspace-in-agent-search'
89+
export const LAST_USED_SEARCH_FILES_AGENT_STATE_KEY =
90+
'last-used-search-files-agent'
8991

9092
export const LAST_INTELLIGENT_FILE_SEARCH_SHRINK_STATE_KEY =
9193
'last-intelligent-file-search-shrink'

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/antigravity.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export const antigravity_agent: CodingAgent = {
4040
last_action_name = action_name
4141
action_count = 1
4242
}
43-
const extra_dots = action_count > 1 ? '.'.repeat(action_count - 1) : ''
43+
const extra_dots =
44+
action_count > 1
45+
? (has_dots ? ' ' : '') + '.'.repeat(action_count - 1)
46+
: ''
4447
report_progress(`${action_name}${has_dots ? '...' : ''}${extra_dots}`)
4548
}
4649
} else if (parsed.event == 'result' && parsed.result) {

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/codex.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export const codex_agent: CodingAgent = {
5050
last_action_name = action_name
5151
action_count = 1
5252
}
53-
const extra_dots = action_count > 1 ? '.'.repeat(action_count - 1) : ''
53+
const extra_dots =
54+
action_count > 1 ? ' ' + '.'.repeat(action_count - 1) : ''
5455
report_progress(`${action_name}...${extra_dots}`)
5556
}
5657
} else if (parsed.type == 'item.completed' && parsed.item) {

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/muse.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export const muse_agent: CodingAgent = {
4848
last_action_name = action_name
4949
action_count = 1
5050
}
51-
const extra_dots = action_count > 1 ? '.'.repeat(action_count - 1) : ''
51+
const extra_dots =
52+
action_count > 1 ? ' ' + '.'.repeat(action_count - 1) : ''
5253
report_progress(`${action_name}...${extra_dots}`)
5354
} else if (
5455
parsed.type === 'status' ||

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/agents/opencode.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export const opencode_agent: CodingAgent = {
3333
last_action_name = action_name
3434
action_count = 1
3535
}
36-
const extra_dots = action_count > 1 ? '.'.repeat(action_count - 1) : ''
36+
const extra_dots =
37+
action_count > 1 ? ' ' + '.'.repeat(action_count - 1) : ''
3738
report_progress(`${action_name}...${extra_dots}`)
3839
} else if (parsed.type == 'result' && parsed.result) {
3940
last_action_name = ''

‎apps/editor/src/features/search-files/search-modes/perform-agent-search-mode/perform-agent-search-mode.ts‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import * as path from 'path'
66
import * as fs from 'fs'
77
import {
88
LAST_SELECTED_WORKSPACE_IN_AGENT_SEARCH_STATE_KEY,
9-
LAST_SEARCH_FILES_AGENT_QUERY_STATE_KEY
9+
LAST_SEARCH_FILES_AGENT_QUERY_STATE_KEY,
10+
LAST_USED_SEARCH_FILES_AGENT_STATE_KEY
1011
} from '@/constants/state-keys'
1112
import { extract_paths_from_bullet_list } from '@/utils/extract-paths-from-bullet-list'
1213
import { get_all_workspace_files } from '@/context/helpers/get-all-workspace-files'
@@ -204,6 +205,20 @@ export const perform_agent_search_mode = async (params: {
204205

205206
const agent_quick_pick = vscode.window.createQuickPick<AgentPickItem>()
206207
agent_quick_pick.items = build_agent_picks()
208+
209+
const last_used_agent =
210+
params.extension_context.workspaceState.get<string>(
211+
LAST_USED_SEARCH_FILES_AGENT_STATE_KEY
212+
)
213+
if (last_used_agent) {
214+
const active_item = agent_quick_pick.items.find(
215+
(i) => i.cmd == last_used_agent
216+
)
217+
if (active_item) {
218+
agent_quick_pick.activeItems = [active_item]
219+
}
220+
}
221+
207222
agent_quick_pick.title = t('feature.search-files.agent.select-agent')
208223
agent_quick_pick.placeholder = t(
209224
'feature.search-files.agent.select-agent-placeholder'
@@ -398,6 +413,11 @@ export const perform_agent_search_mode = async (params: {
398413
const selected_agent_cmd = agent_selection_result.cmd
399414
const flags_string = agent_selection_result.flag_value
400415

416+
await params.extension_context.workspaceState.update(
417+
LAST_USED_SEARCH_FILES_AGENT_STATE_KEY,
418+
selected_agent_cmd
419+
)
420+
401421
let go_back_to_agent = false
402422

403423
while (true) {

0 commit comments

Comments
 (0)