Skip to content

Commit 9db37b0

Browse files
committed
Disable semantic search mode during sub-searches
- in phrase/keywords, should not show progress notification when searching in less than 1000 files
1 parent e78fe3e commit 9db37b0

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎apps/editor/src/features/search-files/actions/search-files.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const search_files = async (params: {
2525
workspace_provider: WorkspaceProvider
2626
extension_context: vscode.ExtensionContext
2727
show_back_button?: boolean
28+
is_sub_search?: boolean
2829
}): Promise<
2930
{ selected_paths: string[]; matched_paths: string[] } | undefined | 'back'
3031
> => {
@@ -47,7 +48,8 @@ export const search_files = async (params: {
4748
try {
4849
const mode_result = await prompt_for_search_mode(
4950
initial_search_mode,
50-
params.show_back_button
51+
params.show_back_button,
52+
params.is_sub_search
5153
)
5254
if (mode_result == 'back') return 'back'
5355
if (!mode_result) return undefined
@@ -133,7 +135,8 @@ export const search_files = async (params: {
133135
get_files: async () => matched_paths,
134136
workspace_provider: params.workspace_provider,
135137
extension_context: params.extension_context,
136-
show_back_button: true
138+
show_back_button: true,
139+
is_sub_search: true
137140
})
138141
})
139142

@@ -283,7 +286,8 @@ export const search_files = async (params: {
283286
get_files: async () => selected_items.matched_paths,
284287
workspace_provider: params.workspace_provider,
285288
extension_context: params.extension_context,
286-
show_back_button: true
289+
show_back_button: true,
290+
is_sub_search: true
287291
})
288292

289293
if (sub_search_result === 'back') {

‎apps/editor/src/features/search-files/utils/prompt-for-search-mode.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { t } from '@/i18n'
33

44
export const prompt_for_search_mode = async (
55
last_mode: 'phrase' | 'keywords' | 'intelligent' | 'semantic',
6-
show_back_button?: boolean
6+
show_back_button?: boolean,
7+
disable_semantic?: boolean
78
): Promise<
89
'phrase' | 'keywords' | 'intelligent' | 'semantic' | undefined | 'back'
910
> => {
@@ -12,7 +13,7 @@ export const prompt_for_search_mode = async (
1213
tooltip: 'Semble Quickstart'
1314
}
1415

15-
const items: (vscode.QuickPickItem & {
16+
let items: (vscode.QuickPickItem & {
1617
mode: 'phrase' | 'keywords' | 'intelligent' | 'semantic'
1718
})[] = [
1819
{
@@ -38,6 +39,10 @@ export const prompt_for_search_mode = async (
3839
}
3940
]
4041

42+
if (disable_semantic) {
43+
items = items.filter((i) => i.mode !== 'semantic')
44+
}
45+
4146
const active_item = items.find((i) => i.mode == last_mode) || items[0]
4247

4348
const close_button = {

0 commit comments

Comments
 (0)