@@ -53,7 +53,10 @@ import {
5353 handle_accept_commit_message ,
5454 handle_cancel_commit_message ,
5555 handle_hash_sign_quick_pick ,
56- handle_proceed_with_commit
56+ handle_proceed_with_commit ,
57+ handle_get_collapsed_states ,
58+ handle_manage_configurations ,
59+ handle_save_component_collapsed_state
5760} from './message-handlers'
5861import {
5962 API_EDIT_FORMAT_STATE_KEY ,
@@ -549,55 +552,11 @@ export class PanelProvider implements vscode.WebviewViewProvider {
549552 } else if ( message . command == 'CANCEL_COMMIT_MESSAGE' ) {
550553 await handle_cancel_commit_message ( this )
551554 } else if ( message . command == 'MANAGE_CONFIGURATIONS' ) {
552- const section =
553- message . api_mode == 'edit-context'
554- ? 'edit-context'
555- : 'code-completions'
556- await vscode . commands . executeCommand (
557- 'codeWebChat.settings' ,
558- section
559- )
555+ await handle_manage_configurations ( message )
560556 } else if ( message . command == 'GET_COLLAPSED_STATES' ) {
561- const WEB_MODES : WebMode [ ] = [
562- 'ask' ,
563- 'edit-context' ,
564- 'code-completions' ,
565- 'no-context'
566- ]
567- const API_MODES : ApiMode [ ] = [ 'edit-context' , 'code-completions' ]
568- this . send_message ( {
569- command : 'COLLAPSED_STATES' ,
570- presets_collapsed_by_web_mode : Object . fromEntries (
571- WEB_MODES . map ( ( mode ) => [
572- mode ,
573- this . context . globalState . get < boolean > (
574- get_presets_collapsed_state_key ( mode ) ,
575- false
576- )
577- ] )
578- ) ,
579- configurations_collapsed_by_api_mode : Object . fromEntries (
580- API_MODES . map ( ( mode ) => [
581- mode ,
582- this . context . globalState . get < boolean > (
583- get_configurations_collapsed_state_key ( mode ) ,
584- false
585- )
586- ] )
587- )
588- } )
557+ handle_get_collapsed_states ( this )
589558 } else if ( message . command == 'SAVE_COMPONENT_COLLAPSED_STATE' ) {
590- if ( message . component == 'presets' ) {
591- await this . context . globalState . update (
592- get_presets_collapsed_state_key ( message . mode as WebMode ) ,
593- message . is_collapsed
594- )
595- } else if ( message . component == 'configurations' ) {
596- await this . context . globalState . update (
597- get_configurations_collapsed_state_key ( message . mode as ApiMode ) ,
598- message . is_collapsed
599- )
600- }
559+ await handle_save_component_collapsed_state ( this , message )
601560 }
602561 } catch ( error : any ) {
603562 Logger . error ( {
0 commit comments