@@ -8,33 +8,33 @@ import { chat_code_completion_instructions } from '@/constants/instructions'
88import { apply_preset_affixes_to_instruction } from '@/utils/apply-preset-affixes'
99import { HOME_VIEW_TYPES } from '@/view/types/home-view-type'
1010
11- export const handle_copy_prompt = async (
12- provider : ViewProvider ,
13- instructions : string ,
11+ export const handle_copy_prompt = async ( params : {
12+ provider : ViewProvider
13+ instructions : string
1414 preset_name ?: string
15- ) : Promise < void > => {
15+ } ) : Promise < void > => {
1616 const files_collector = new FilesCollector (
17- provider . workspace_provider ,
18- provider . open_editors_provider ,
19- provider . websites_provider
17+ params . provider . workspace_provider ,
18+ params . provider . open_editors_provider ,
19+ params . provider . websites_provider
2020 )
2121
2222 const active_editor = vscode . window . activeTextEditor
2323
24- let final_instruction = instructions
25- if ( preset_name !== undefined ) {
24+ let final_instruction = params . instructions
25+ if ( params . preset_name !== undefined ) {
2626 final_instruction = apply_preset_affixes_to_instruction (
27- instructions ,
28- preset_name ,
29- provider . get_presets_config_key ( )
27+ params . instructions ,
28+ params . preset_name ,
29+ params . provider . get_presets_config_key ( )
3030 )
3131 }
3232
3333 const is_in_code_completions_mode =
34- ( provider . home_view_type == HOME_VIEW_TYPES . WEB &&
35- provider . web_mode == 'code-completions' ) ||
36- ( provider . home_view_type == HOME_VIEW_TYPES . API &&
37- provider . api_mode == 'code-completions' )
34+ ( params . provider . home_view_type == HOME_VIEW_TYPES . WEB &&
35+ params . provider . web_mode == 'code-completions' ) ||
36+ ( params . provider . home_view_type == HOME_VIEW_TYPES . API &&
37+ params . provider . api_mode == 'code-completions' )
3838
3939 if ( is_in_code_completions_mode && active_editor ) {
4040 const document = active_editor . document
@@ -71,7 +71,7 @@ export const handle_copy_prompt = async (
7171
7272 const context_text = await files_collector . collect_files ( {
7373 additional_paths,
74- no_context : provider . web_mode == 'no-context'
74+ no_context : params . provider . web_mode == 'no-context'
7575 } )
7676
7777 const instructions = replace_selection_placeholder ( final_instruction )
@@ -86,22 +86,22 @@ export const handle_copy_prompt = async (
8686 if ( instructions . includes ( '@SavedContext:' ) ) {
8787 pre_context_instructions = await replace_saved_context_placeholder (
8888 pre_context_instructions ,
89- provider . context ,
90- provider . workspace_provider
89+ params . provider . context ,
90+ params . provider . workspace_provider
9191 )
9292 post_context_instructions = await replace_saved_context_placeholder (
9393 post_context_instructions ,
94- provider . context ,
95- provider . workspace_provider ,
94+ params . provider . context ,
95+ params . provider . workspace_provider ,
9696 true
9797 )
9898 }
9999
100- if ( provider . web_mode == 'edit-context' ) {
100+ if ( params . provider . web_mode == 'edit-context' ) {
101101 const edit_format =
102- provider . home_view_type == HOME_VIEW_TYPES . WEB
103- ? provider . chat_edit_format
104- : provider . api_edit_format
102+ params . provider . home_view_type == HOME_VIEW_TYPES . WEB
103+ ? params . provider . chat_edit_format
104+ : params . provider . api_edit_format
105105 const all_instructions = vscode . workspace
106106 . getConfiguration ( 'codeWebChat' )
107107 . get < { [ key : string ] : string } > ( 'editFormatInstructions' )
@@ -126,7 +126,7 @@ export const handle_copy_prompt = async (
126126
127127 vscode . window . showInformationMessage (
128128 `Prompt${
129- preset_name ? ` with preset "${ preset_name } "` : ''
129+ params . preset_name ? ` with preset "${ params . preset_name } "` : ''
130130 } copied to clipboard!`
131131 )
132132}
0 commit comments