@@ -7,12 +7,12 @@ import {
77import { dictionary } from '@shared/constants/dictionary'
88import { ToolType } from '../settings/types/tools'
99
10- export const delete_configuration = async (
11- context : vscode . ExtensionContext ,
12- configuration_id : string ,
10+ export const delete_configuration = async ( params : {
11+ context : vscode . ExtensionContext
12+ configuration_id : string
1313 type : ToolType
14- ) : Promise < void > => {
15- const providers_manager = new ModelProvidersManager ( context )
14+ } ) : Promise < void > => {
15+ const providers_manager = new ModelProvidersManager ( params . context )
1616
1717 let get_configs : ( ) => Promise < ToolConfig [ ] >
1818 let save_configs : ( configs : ToolConfig [ ] ) => Promise < void >
@@ -21,53 +21,53 @@ export const delete_configuration = async (
2121 | ( ( config : ToolConfig | null ) => Promise < void > )
2222 | undefined
2323
24- if ( type == 'code-at-cursor' ) {
24+ if ( params . type == 'code-at-cursor' ) {
2525 get_configs = ( ) => providers_manager . get_code_completions_tool_configs ( )
2626 save_configs = ( c ) =>
2727 providers_manager . save_code_completions_tool_configs ( c )
2828 get_default_config = ( ) =>
2929 providers_manager . get_default_code_completions_config ( )
3030 set_default_config = ( c ) =>
3131 providers_manager . set_default_code_completions_config ( c )
32- } else if ( type == 'edit-context' ) {
32+ } else if ( params . type == 'edit-context' ) {
3333 get_configs = ( ) => providers_manager . get_edit_context_tool_configs ( )
3434 save_configs = ( c ) => providers_manager . save_edit_context_tool_configs ( c )
35- } else if ( type == 'intelligent-update' ) {
35+ } else if ( params . type == 'intelligent-update' ) {
3636 get_configs = ( ) => providers_manager . get_intelligent_update_tool_configs ( )
3737 save_configs = ( c ) =>
3838 providers_manager . save_intelligent_update_tool_configs ( c )
3939 get_default_config = ( ) =>
4040 providers_manager . get_default_intelligent_update_config ( )
4141 set_default_config = ( c ) =>
4242 providers_manager . set_default_intelligent_update_config ( c )
43- } else if ( type == 'commit-messages' ) {
43+ } else if ( params . type == 'commit-messages' ) {
4444 get_configs = ( ) => providers_manager . get_commit_messages_tool_configs ( )
4545 save_configs = ( c ) => providers_manager . save_commit_messages_tool_configs ( c )
4646 get_default_config = ( ) =>
4747 providers_manager . get_default_commit_messages_config ( )
4848 set_default_config = ( c ) =>
4949 providers_manager . set_default_commit_messages_config ( c )
50- } else if ( type == 'prune-context' ) {
50+ } else if ( params . type == 'prune-context' ) {
5151 get_configs = ( ) => providers_manager . get_prune_context_tool_configs ( )
5252 save_configs = ( c ) => providers_manager . save_prune_context_tool_configs ( c )
5353 get_default_config = ( ) =>
5454 providers_manager . get_default_prune_context_config ( )
5555 set_default_config = ( c ) =>
5656 providers_manager . set_default_prune_context_config ( c )
57- } else if ( type == 'voice-input' ) {
57+ } else if ( params . type == 'voice-input' ) {
5858 get_configs = ( ) => providers_manager . get_voice_input_tool_configs ( )
5959 save_configs = ( c ) => providers_manager . save_voice_input_tool_configs ( c )
6060 get_default_config = ( ) =>
6161 providers_manager . get_default_voice_input_config ( )
6262 set_default_config = ( c ) =>
6363 providers_manager . set_default_voice_input_config ( c )
6464 } else {
65- throw new Error ( `Unknown tool type: ${ type } ` )
65+ throw new Error ( `Unknown tool type: ${ params . type } ` )
6666 }
6767
6868 const original_configs = await get_configs ( )
6969 const config_to_delete = original_configs . find (
70- ( c ) => get_tool_config_id ( c ) === configuration_id
70+ ( c ) => get_tool_config_id ( c ) === params . configuration_id
7171 )
7272 if ( ! config_to_delete ) return
7373
@@ -88,15 +88,15 @@ export const delete_configuration = async (
8888 }
8989
9090 const updated_configs = original_configs . filter (
91- ( c ) => get_tool_config_id ( c ) !== configuration_id
91+ ( c ) => get_tool_config_id ( c ) !== params . configuration_id
9292 )
9393 await save_configs ( updated_configs )
9494
9595 if ( get_default_config && set_default_config ) {
9696 const original_default_config = await get_default_config ( )
9797 if (
9898 original_default_config &&
99- get_tool_config_id ( original_default_config ) === configuration_id
99+ get_tool_config_id ( original_default_config ) === params . configuration_id
100100 ) {
101101 await set_default_config ( null )
102102 }
0 commit comments