Skip to content

Commit adfb31f

Browse files
committed
Remove the include selected files feature
- remove toggling 'include selected files' (we want to always include
1 parent b4a9777 commit adfb31f

11 files changed

Lines changed: 22 additions & 135 deletions

File tree

‎apps/editor/src/sfsdf.ts‎

Whitespace-only changes.

‎apps/editor/src/views/prompt/backend/message-handlers/handle-make-api-call.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export const handle_make_api_call = async (
175175
prompt_view_provider
176176
})
177177

178-
if (prompt_view_provider.include_selected_files && !collected_files) {
178+
if (!collected_files) {
179179
prompt_view_provider.send_message({
180180
command: 'SHOW_AUTO_CLOSING_MODAL',
181181
title: t('views.prompt.handlers.make-api-call.context-cannot-be-empty'),

‎apps/editor/src/views/prompt/backend/message-handlers/utils/build-prompt-payload.ts‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ export const build_prompt_payload = async (params: {
1717
let recent_files = ''
1818
let collected_files = ''
1919

20-
if (prompt_view_provider.include_selected_files) {
21-
const collected = await FilesCollector.collect_files({
22-
workspace_provider: prompt_view_provider.workspace_provider,
23-
open_editors_provider: prompt_view_provider.open_editors_provider
24-
})
25-
other_files = collected.other_files
26-
recent_files = collected.recent_files
27-
collected_files = other_files + recent_files
28-
}
20+
const collected = await FilesCollector.collect_files({
21+
workspace_provider: prompt_view_provider.workspace_provider,
22+
open_editors_provider: prompt_view_provider.open_editors_provider
23+
})
24+
other_files = collected.other_files
25+
recent_files = collected.recent_files
26+
collected_files = other_files + recent_files
2927

3028
const { instructions: processed_instructions, skill_definitions } =
3129
await replace_symbols({

‎apps/editor/src/views/prompt/backend/prompt-view-provider.ts‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
142142
public api_edit_format: EditFormat
143143
public api_prompt_type: ApiPromptType
144144
public mode: Mode = MODE.WEB
145-
public include_selected_files: boolean = true
146145

147146
public get edit_format(): EditFormat {
148147
return this.mode == MODE.WEB ? this.web_edit_format : this.api_edit_format
@@ -349,12 +348,6 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
349348
'edit-files'
350349
)
351350

352-
this.include_selected_files =
353-
this.extension_context.workspaceState.get<boolean>(
354-
'codeWebChat.includeSelectedFiles',
355-
true
356-
)
357-
358351
this.extension_context.subscriptions.push(
359352
vscode.window.onDidChangeWindowState(async (e) => {
360353
if (e.focused) {
@@ -857,25 +850,10 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
857850
await handle_pick_tasks_workspace(this, message)
858851
} else if (message.command == 'GET_TOKEN_COUNT') {
859852
this.send_token_count()
860-
} else if (message.command == 'GET_INCLUDE_SELECTED_FILES') {
861-
this.send_message({
862-
command: 'INCLUDE_SELECTED_FILES',
863-
include: this.include_selected_files
864-
})
865853
} else if (message.command == 'PREVIEW_PROMPT') {
866854
await handle_preview_prompt({
867855
prompt_view_provider: this
868856
})
869-
} else if (message.command == 'TOGGLE_INCLUDE_SELECTED_FILES') {
870-
this.include_selected_files = message.include
871-
this.extension_context.workspaceState.update(
872-
'codeWebChat.includeSelectedFiles',
873-
message.include
874-
)
875-
this.send_message({
876-
command: 'INCLUDE_SELECTED_FILES',
877-
include: this.include_selected_files
878-
})
879857
}
880858
} catch (error: any) {
881859
Logger.error({

‎apps/editor/src/views/prompt/frontend/Main/Main.tsx‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ type Props = {
7272
edit_instructions_token_count: number
7373
ask_instructions_token_count: number
7474
bottom_spacer_height?: number
75-
include_selected_files: boolean
76-
on_toggle_include_selected_files: (include: boolean) => void
7775
on_preview_prompt: () => void
7876
}
7977

@@ -547,8 +545,6 @@ export const Main: React.FC<Props> = (props) => {
547545
on_tabs_reorder={props.on_tabs_reorder}
548546
voice_input_push_to_talk={props.voice_input_push_to_talk}
549547
bottom_spacer_height={props.bottom_spacer_height}
550-
include_selected_files={props.include_selected_files}
551-
on_toggle_include_selected_files={props.on_toggle_include_selected_files}
552548
on_preview_prompt={props.on_preview_prompt}
553549
/>
554550
)

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ type Props = {
109109
on_tabs_reorder: (new_order: number[]) => void
110110
voice_input_push_to_talk: boolean
111111
bottom_spacer_height?: number
112-
include_selected_files: boolean
113-
on_toggle_include_selected_files: (include: boolean) => void
114112
on_preview_prompt: () => void
115113
}
116114

@@ -372,16 +370,9 @@ export const MainView: React.FC<Props> = (props) => {
372370
<UiSelectedFiles
373371
selected_files_token_count={props.selected_files_token_count}
374372
selected_files_count={props.selected_files.length}
375-
include_selected_files={props.include_selected_files}
376-
on_toggle_include_selected_files={
377-
props.on_toggle_include_selected_files
378-
}
379373
translations={{
380374
attach_selected_files: t('selected-files.attach-selected-files'),
381-
attaching_files: t('selected-files.attaching-files'),
382-
disabled_attaching_selected_files: t(
383-
'selected-files.disabled-attaching-selected-files'
384-
)
375+
attaching_files: t('selected-files.attaching-files')
385376
}}
386377
/>
387378

‎apps/editor/src/views/prompt/frontend/Prompt.tsx‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ export const Prompt = () => {
7676
selected_files_token_count,
7777
edit_instructions_token_count,
7878
ask_instructions_token_count,
79-
include_selected_files,
80-
handle_toggle_include_selected_files,
8179
handle_preview_prompt
8280
} = use_panel(vscode)
8381

@@ -357,10 +355,6 @@ export const Prompt = () => {
357355
selected_files_token_count={selected_files_token_count}
358356
edit_instructions_token_count={edit_instructions_token_count}
359357
ask_instructions_token_count={ask_instructions_token_count}
360-
include_selected_files={include_selected_files}
361-
on_toggle_include_selected_files={
362-
handle_toggle_include_selected_files
363-
}
364358
on_preview_prompt={handle_preview_prompt}
365359
/>
366360
</div>

‎apps/editor/src/views/prompt/frontend/hooks/use-prompt/use-prompt.ts‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export const use_prompt = (vscode: any) => {
3131
useState<number>(0)
3232
const [ask_instructions_token_count, set_ask_instructions_token_count] =
3333
useState<number>(0)
34-
const [include_selected_files, set_include_selected_files] =
35-
useState<boolean>(true)
3634

3735
const {
3836
ask_about_context_instructions,
@@ -137,8 +135,6 @@ export const use_prompt = (vscode: any) => {
137135
set_ask_instructions_token_count(message.ask_instructions_token_count)
138136
} else if (message.command == 'IS_MODERN_UI') {
139137
set_is_modern_ui(message.is_modern_ui)
140-
} else if (message.command == 'INCLUDE_SELECTED_FILES') {
141-
set_include_selected_files(message.include)
142138
}
143139
}
144140
window.addEventListener('message', handle_message)
@@ -154,8 +150,7 @@ export const use_prompt = (vscode: any) => {
154150
{ command: 'GET_SETUP_PROGRESS' },
155151
{ command: 'GET_VOICE_INPUT_PUSH_TO_TALK' },
156152
{ command: 'GET_IS_MODERN_UI' },
157-
{ command: 'GET_TOKEN_COUNT' },
158-
{ command: 'GET_INCLUDE_SELECTED_FILES' }
153+
{ command: 'GET_TOKEN_COUNT' }
159154
]
160155
initial_messages.forEach((message) => post_message(vscode, message))
161156

@@ -214,14 +209,6 @@ export const use_prompt = (vscode: any) => {
214209
})
215210
}
216211

217-
const handle_toggle_include_selected_files = (include: boolean) => {
218-
set_include_selected_files(include)
219-
post_message(vscode, {
220-
command: 'TOGGLE_INCLUDE_SELECTED_FILES',
221-
include
222-
})
223-
}
224-
225212
const is_setup_complete = setup_progress
226213
? Object.values(setup_progress).every((v) => v)
227214
: true
@@ -265,8 +252,6 @@ export const use_prompt = (vscode: any) => {
265252
selected_files_token_count,
266253
edit_instructions_token_count,
267254
ask_instructions_token_count,
268-
include_selected_files,
269-
handle_toggle_include_selected_files,
270255
handle_preview_prompt
271256
}
272257
}

‎apps/editor/src/views/prompt/types/messages.ts‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -508,15 +508,6 @@ export interface GetTokenCountMessage extends BaseMessage {
508508
command: 'GET_TOKEN_COUNT'
509509
}
510510

511-
export interface ToggleIncludeSelectedFilesMessage extends BaseMessage {
512-
command: 'TOGGLE_INCLUDE_SELECTED_FILES'
513-
include: boolean
514-
}
515-
516-
export interface GetIncludeSelectedFilesMessage extends BaseMessage {
517-
command: 'GET_INCLUDE_SELECTED_FILES'
518-
}
519-
520511
export interface PreviewPromptMessage extends BaseMessage {
521512
command: 'PREVIEW_PROMPT'
522513
}
@@ -609,8 +600,6 @@ export type FrontendMessage =
609600
| PickTasksWorkspaceMessage
610601
| GetIsModernUiMessage
611602
| GetTokenCountMessage
612-
| ToggleIncludeSelectedFilesMessage
613-
| GetIncludeSelectedFilesMessage
614603
| PreviewPromptMessage
615604

616605
// === FROM BACKEND TO FRONTEND ===
@@ -861,11 +850,6 @@ export interface IsModernUiMessage extends BaseMessage {
861850
is_modern_ui: boolean
862851
}
863852

864-
export interface IncludeSelectedFilesMessage extends BaseMessage {
865-
command: 'INCLUDE_SELECTED_FILES'
866-
include: boolean
867-
}
868-
869853
export type BackendMessage =
870854
| InstructionsMessage
871855
| FocusPromptFieldMessage
@@ -919,4 +903,3 @@ export type BackendMessage =
919903
| StartApiConfigurationCreationMessage
920904
| TasksWorkspacePickedMessage
921905
| IsModernUiMessage
922-
| IncludeSelectedFilesMessage

‎packages/ui/src/components/editor/prompt/SelectedFiles/SelectedFiles.stories.tsx‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,30 @@
1-
import { useState } from 'react'
21
import { SelectedFiles } from './SelectedFiles'
32

43
export default {
54
component: SelectedFiles
65
}
76

87
export const Default = () => {
9-
const [include, set_include] = useState(true)
10-
118
return (
129
<SelectedFiles
1310
selected_files_token_count={12500}
1411
selected_files_count={5}
15-
include_selected_files={include}
16-
on_toggle_include_selected_files={set_include}
1712
translations={{
1813
attach_selected_files: 'Attach selected files',
19-
attaching_files: 'Attaching {files} files',
20-
disabled_attaching_selected_files: 'Disabled attaching selected files!'
14+
attaching_files: 'Attaching {files} files'
2115
}}
2216
/>
2317
)
2418
}
2519

2620
export const ZeroTokens = () => {
27-
const [include, set_include] = useState(false)
28-
2921
return (
3022
<SelectedFiles
3123
selected_files_token_count={0}
3224
selected_files_count={0}
33-
include_selected_files={include}
34-
on_toggle_include_selected_files={set_include}
3525
translations={{
3626
attach_selected_files: 'Attach selected files',
37-
attaching_files: 'Attaching {files} files',
38-
disabled_attaching_selected_files: 'Disabled attaching selected files!'
27+
attaching_files: 'Attaching {files} files'
3928
}}
4029
/>
4130
)

0 commit comments

Comments
 (0)