Skip to content

Commit c10463c

Browse files
committed
Add exclude parameter to hash sign quick pick and exclude commit option in settings
- in settings, hash symbol should exclude 'commit' └── apps └── editor └── src └── views ├── settings │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-hash-sign-quick-pick.ts │ │ │ └── index.ts │ │ └── settings-view-provider.ts │ ├── frontend │ │ └── forms │ │ └── EditTemplateForm │ │ └── EditTemplateForm.tsx │ └── types │ └── messages.ts └── shared └── utils └── hash-sign-quick-pick ├── hash-sign-quick-pick.ts └── symbols ├── commit-symbol.ts └── index.ts
1 parent cecdaf0 commit c10463c

2 files changed

Lines changed: 55 additions & 34 deletions

File tree

‎apps/editor/src/views/settings/backend/message-handlers/handle-hash-sign-quick-pick.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const handle_hash_sign_quick_pick = async (
1313

1414
const replacement = await hash_sign_quick_pick({
1515
extension_context: provider.extension_context,
16-
on_insert
16+
on_insert,
17+
exclude: ['commit']
1718
})
1819

1920
if (replacement) {

‎apps/editor/src/views/shared/utils/hash-sign-quick-pick/hash-sign-quick-pick.ts‎

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,61 @@ const skill_label = `$(thinking) ${t('views.shared.utils.hash-sign-quick-pick.qu
1616
export const hash_sign_quick_pick = async (params: {
1717
extension_context: vscode.ExtensionContext
1818
on_insert: (text: string) => void
19+
exclude?: ('changes' | 'commit' | 'saved-context' | 'skill')[]
1920
}): Promise<string | undefined> => {
20-
const items: vscode.QuickPickItem[] = [
21-
{
22-
label: changes_label,
23-
description: t(
24-
'views.shared.utils.hash-sign-quick-pick.quick-pick.changes.description'
25-
)
26-
},
27-
{
28-
label: commit_label,
29-
description: t(
30-
'views.shared.utils.hash-sign-quick-pick.quick-pick.commit.description'
31-
)
32-
},
33-
{
34-
label: saved_context_label,
35-
description: t(
36-
'views.shared.utils.hash-sign-quick-pick.quick-pick.saved-context.description'
37-
)
38-
},
39-
{
40-
label: skill_label,
41-
description: t(
42-
'views.shared.utils.hash-sign-quick-pick.quick-pick.skill.description'
43-
),
44-
buttons: [
45-
{
46-
iconPath: new vscode.ThemeIcon('globe'),
47-
tooltip: t(
48-
'views.shared.utils.hash-sign-quick-pick.quick-pick.skill.tooltip'
49-
)
50-
}
51-
]
21+
const items: vscode.QuickPickItem[] = (
22+
[
23+
{
24+
label: changes_label,
25+
description: t(
26+
'views.shared.utils.hash-sign-quick-pick.quick-pick.changes.description'
27+
)
28+
},
29+
{
30+
label: commit_label,
31+
description: t(
32+
'views.shared.utils.hash-sign-quick-pick.quick-pick.commit.description'
33+
)
34+
},
35+
{
36+
label: saved_context_label,
37+
description: t(
38+
'views.shared.utils.hash-sign-quick-pick.quick-pick.saved-context.description'
39+
)
40+
},
41+
{
42+
label: skill_label,
43+
description: t(
44+
'views.shared.utils.hash-sign-quick-pick.quick-pick.skill.description'
45+
),
46+
buttons: [
47+
{
48+
iconPath: new vscode.ThemeIcon('globe'),
49+
tooltip: t(
50+
'views.shared.utils.hash-sign-quick-pick.quick-pick.skill.tooltip'
51+
)
52+
}
53+
]
54+
}
55+
] as vscode.QuickPickItem[]
56+
).filter((item) => {
57+
if (params.exclude?.includes('changes') && item.label == changes_label) {
58+
return false
59+
}
60+
if (params.exclude?.includes('commit') && item.label == commit_label) {
61+
return false
62+
}
63+
if (
64+
params.exclude?.includes('saved-context') &&
65+
item.label === saved_context_label
66+
) {
67+
return false
68+
}
69+
if (params.exclude?.includes('skill') && item.label == skill_label) {
70+
return false
5271
}
53-
]
72+
return true
73+
})
5474

5575
const last_selected_symbol =
5676
params.extension_context.workspaceState.get<string>(

0 commit comments

Comments
 (0)