Skip to content

Commit 25a3b7c

Browse files
committed
Consolidate the sign quick pick logic directly within its message handler
1 parent a2c27f0 commit 25a3b7c

3 files changed

Lines changed: 45 additions & 46 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ No-cost AI coding in free chatbots for <a href="https://marketplace.visualstudio
66

77
🌐 **Initializes web chats**—ChatGPT, Claude, Gemini, DeepSeek, and more \
88
🪄 **Applies responses**—multi-file changes integration with confidence \
9-
🧠 **Non-agentic by design**—squeeze maximum performance out of LLMs \
109
🔋 **Batteries included**—code completions, checkpoints, and more \
10+
🏃 **Non-agentic by design**—for blazing fast, accurate results \
1111
🫰 **Saves money and time**—zero endless tool-calling \
1212
🫶 **Free and open-source**—the GPL-3.0 license
1313

‎packages/vscode/src/views/panel/backend/message-handlers/handle-at-sign-quick-pick.ts‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
11
import { ViewProvider } from '@/views/panel/backend/panel-provider'
2-
import { at_sign_quick_pick } from '@/views/panel/backend/utils/at-sign-quick-pick'
32
import { HOME_VIEW_TYPES } from '@/views/panel/types/home-view-type'
3+
import * as vscode from 'vscode'
4+
import * as path from 'path'
5+
import { WorkspaceProvider } from '@/context/providers/workspace-provider'
6+
import { natural_sort } from '@/utils/natural-sort'
7+
8+
const at_sign_quick_pick = async (params: {
9+
workspace_provider: WorkspaceProvider
10+
}): Promise<string | undefined> => {
11+
const checked_paths = params.workspace_provider.get_all_checked_paths()
12+
if (checked_paths.length == 0) {
13+
vscode.window.showWarningMessage('Nothing is selected in context.')
14+
return
15+
}
16+
17+
const workspace_roots = params.workspace_provider.getWorkspaceRoots()
18+
19+
const quick_pick_items = checked_paths.map((p) => {
20+
let relative_path = p
21+
const root = params.workspace_provider.get_workspace_root_for_file(p)
22+
if (root) {
23+
if (workspace_roots.length > 1) {
24+
const ws_name = params.workspace_provider.get_workspace_name(root)
25+
relative_path = path.join(ws_name, path.relative(root, p))
26+
} else {
27+
relative_path = path.relative(root, p)
28+
}
29+
}
30+
return { label: relative_path.replace(/\\/g, '/') }
31+
})
32+
33+
quick_pick_items.sort((a, b) => natural_sort(a.label, b.label))
34+
35+
const selected_path_item = await vscode.window.showQuickPick(
36+
quick_pick_items,
37+
{
38+
placeHolder: 'Select a path to place in the input field'
39+
}
40+
)
41+
42+
if (selected_path_item) {
43+
return `\`${selected_path_item.label}\` `
44+
}
45+
return
46+
}
447

548
export const handle_at_sign_quick_pick = async (
649
provider: ViewProvider

‎packages/vscode/src/views/panel/backend/utils/at-sign-quick-pick.ts‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)