@@ -10,6 +10,7 @@ import {
1010 NotebookEdit ,
1111 Position ,
1212 Range ,
13+ ThemeIcon ,
1314 WorkspaceEdit ,
1415 commands ,
1516 l10n ,
@@ -708,38 +709,31 @@ export class DeepnoteInputBlockCellStatusBarItemProvider
708709 if ( allowMultiple ) {
709710 // Multi-select using QuickPick with custom behavior for clear selection
710711 const currentSelection = Array . isArray ( currentValue ) ? currentValue : [ ] ;
711- const clearSelectionLabel = l10n . t ( '$(circle-slash) Clear selection' ) ;
712712
713- // Create quick pick items
713+ // Create quick pick items (only actual options, not "Clear selection")
714714 const optionItems = options . map ( ( opt ) => ( {
715715 label : opt ,
716716 picked : currentSelection . includes ( opt )
717717 } ) ) ;
718718
719- // Add empty option if allowed
720- if ( allowEmpty ) {
721- optionItems . unshift ( {
722- label : clearSelectionLabel ,
723- picked : false
724- } ) ;
725- }
726-
727719 // Use createQuickPick for more control
728720 const quickPick = window . createQuickPick ( ) ;
729721 quickPick . items = optionItems ;
730722 quickPick . selectedItems = optionItems . filter ( ( item ) => item . picked ) ;
731723 quickPick . canSelectMany = true ;
732- quickPick . placeholder = allowEmpty
733- ? l10n . t ( 'Select one or more options (or clear selection)' )
734- : l10n . t ( 'Select one or more options' ) ;
724+ quickPick . placeholder = l10n . t ( 'Select one or more options' ) ;
735725
736- // Listen for selection changes to handle "Clear selection" specially
726+ // Add "Clear selection" as a button if empty values are allowed
737727 if ( allowEmpty ) {
738- quickPick . onDidChangeSelection ( ( selectedItems ) => {
739- const hasClearSelection = selectedItems . some ( ( item ) => item . label === clearSelectionLabel ) ;
740- if ( hasClearSelection ) {
741- // If "Clear selection" is selected, immediately clear and close
742- quickPick . selectedItems = [ ] ;
728+ const clearButton = {
729+ iconPath : new ThemeIcon ( 'clear-all' ) ,
730+ tooltip : l10n . t ( 'Clear selection' )
731+ } ;
732+ quickPick . buttons = [ clearButton ] ;
733+
734+ quickPick . onDidTriggerButton ( ( button ) => {
735+ if ( button === clearButton ) {
736+ // Clear selection and close
743737 quickPick . hide ( ) ;
744738 void this . updateCellMetadata ( cell , { deepnote_variable_value : [ ] } ) ;
745739 }
@@ -748,12 +742,8 @@ export class DeepnoteInputBlockCellStatusBarItemProvider
748742
749743 quickPick . onDidAccept ( ( ) => {
750744 const selected = quickPick . selectedItems ;
751- const hasClearSelection = selected . some ( ( item ) => item . label === clearSelectionLabel ) ;
752-
753- if ( ! hasClearSelection ) {
754- const newValue = selected . map ( ( item ) => item . label ) ;
755- void this . updateCellMetadata ( cell , { deepnote_variable_value : newValue } ) ;
756- }
745+ const newValue = selected . map ( ( item ) => item . label ) ;
746+ void this . updateCellMetadata ( cell , { deepnote_variable_value : newValue } ) ;
757747 quickPick . hide ( ) ;
758748 } ) ;
759749
0 commit comments