@@ -310,6 +310,7 @@ async function show_presets_in_group_quick_pick(params: {
310310
311311 quick_pick . items = items
312312 quick_pick . placeholder = 'Search presets by name'
313+ quick_pick . title = 'Select Preset'
313314 quick_pick . matchOnDescription = true
314315
315316 const last_preset_key = get_last_selected_preset_key ( panel_provider . web_mode )
@@ -463,7 +464,7 @@ async function show_preset_quick_pick(params: {
463464
464465 if ( last_choice === 'Preset' && last_selected_preset ) {
465466 const preset = presets . find ( ( p ) => p . name === last_selected_preset )
466- if ( preset ) {
467+ if ( preset && ! preset . isPinned ) {
467468 let group_name = 'Ungrouped'
468469 if ( preset . chatbot ) {
469470 const preset_index = presets . findIndex (
@@ -542,6 +543,11 @@ async function show_preset_quick_pick(params: {
542543 tooltip : 'Run selected presets'
543544 }
544545
546+ const run_without_submission_button : vscode . QuickInputButton = {
547+ iconPath : new vscode . ThemeIcon ( 'debug-continue-small' ) ,
548+ tooltip : 'Run without submission'
549+ }
550+
545551 const quick_pick = vscode . window . createQuickPick <
546552 vscode . QuickPickItem & { preset_name ?: string ; group_name ?: string }
547553 > ( )
@@ -551,6 +557,36 @@ async function show_preset_quick_pick(params: {
551557 group_name ?: string
552558 } ) [ ] = [ ]
553559
560+ const pinned_presets = presets . filter ( ( p ) => p . isPinned && p . chatbot )
561+
562+ if ( pinned_presets . length > 0 ) {
563+ items . push ( { label : 'Pinned' , kind : vscode . QuickPickItemKind . Separator } )
564+ pinned_presets . forEach ( ( preset ) => {
565+ const is_unnamed = ! preset . name || / ^ \( \d + \) $ / . test ( preset . name . trim ( ) )
566+ const chatbot_models = CHATBOTS [ preset . chatbot as keyof typeof CHATBOTS ]
567+ . models as any
568+ const model = preset . model
569+ ? chatbot_models [ preset . model ] ?. label || preset . model
570+ : ''
571+ items . push ( {
572+ label : `$(pinned) ${ is_unnamed ? preset . chatbot ! : preset . name } ` ,
573+ preset_name : preset . name ,
574+ description : is_unnamed
575+ ? model
576+ : `${ preset . chatbot } ${ model ? ` · ${ model } ` : '' } ` ,
577+ buttons : [ run_without_submission_button ]
578+ } )
579+ } )
580+ }
581+
582+ const has_groups =
583+ ( presets . length > 0 && presets [ 0 ] . chatbot ) ||
584+ presets . some ( ( p ) => ! p . chatbot )
585+
586+ if ( has_groups ) {
587+ items . push ( { label : 'Groups' , kind : vscode . QuickPickItemKind . Separator } )
588+ }
589+
554590 if ( presets . length > 0 && presets [ 0 ] . chatbot ) {
555591 let group_presets_count = 0
556592 let selected_presets_count = 0
@@ -607,6 +643,7 @@ async function show_preset_quick_pick(params: {
607643
608644 quick_pick . items = items
609645 quick_pick . placeholder = 'Select a group to run presets from'
646+ quick_pick . title = 'Select Group'
610647 quick_pick . matchOnDescription = true
611648
612649 if ( group_to_highlight_on_back ) {
@@ -642,7 +679,7 @@ async function show_preset_quick_pick(params: {
642679 }
643680
644681 quick_pick . onDidTriggerItemButton ( async ( e ) => {
645- const item = e . item as any & { group_name ?: string }
682+ const item = e . item as any & { group_name ?: string ; preset_name ?: string }
646683 if ( item . group_name && e . button === run_group_button ) {
647684 quick_pick . hide ( )
648685
@@ -659,6 +696,30 @@ async function show_preset_quick_pick(params: {
659696 } )
660697 }
661698 do_resolve ( resolution )
699+ } else if (
700+ item . preset_name &&
701+ e . button === run_without_submission_button
702+ ) {
703+ quick_pick . hide ( )
704+ const preset = presets . find ( ( p ) => p . name === item . preset_name ) !
705+ if ( params . get_is_preset_disabled ( preset ) ) {
706+ if (
707+ ! params . is_in_code_completions_mode &&
708+ ! params . current_instructions &&
709+ ! preset . promptPrefix &&
710+ ! preset . promptSuffix
711+ ) {
712+ vscode . window . showWarningMessage (
713+ dictionary . warning_message . TYPE_SOMETHING_TO_USE_PRESET
714+ )
715+ }
716+ do_resolve ( null )
717+ } else {
718+ do_resolve ( {
719+ preset_names : [ item . preset_name ] ,
720+ without_submission : true
721+ } )
722+ }
662723 }
663724 } )
664725
@@ -671,7 +732,42 @@ async function show_preset_quick_pick(params: {
671732 return
672733 }
673734
674- if ( selected . group_name ) {
735+ if ( selected . preset_name ) {
736+ quick_pick . hide ( )
737+ const preset = presets . find ( ( p ) => p . name === selected . preset_name ) !
738+ if ( params . get_is_preset_disabled ( preset ) ) {
739+ if (
740+ ! params . is_in_code_completions_mode &&
741+ ! params . current_instructions &&
742+ ! preset . promptPrefix &&
743+ ! preset . promptSuffix
744+ ) {
745+ vscode . window . showWarningMessage (
746+ dictionary . warning_message . TYPE_SOMETHING_TO_USE_PRESET
747+ )
748+ }
749+ do_resolve ( null )
750+ } else {
751+ let group_name = 'Ungrouped'
752+ const preset_index = presets . findIndex (
753+ ( p ) => p . name === selected . preset_name
754+ )
755+ if ( preset_index > - 1 ) {
756+ for ( let i = preset_index - 1 ; i >= 0 ; i -- ) {
757+ if ( ! presets [ i ] . chatbot ) {
758+ group_name = presets [ i ] . name
759+ break
760+ }
761+ }
762+ }
763+ update_last_used_preset_or_group ( {
764+ panel_provider,
765+ preset_name : selected . preset_name ,
766+ group_name : group_name
767+ } )
768+ do_resolve ( { preset_names : [ selected . preset_name ] } )
769+ }
770+ } else if ( selected . group_name ) {
675771 is_navigating = true
676772 quick_pick . hide ( )
677773 const result = await show_presets_in_group_quick_pick ( {
0 commit comments