@@ -334,7 +334,10 @@ export class AccessibleView extends Disposable {
334
334
this . _instantiationService . createInstance ( AccessibleViewSymbolQuickPick , this ) . show ( this . _currentProvider ) ;
335
335
}
336
336
337
- calculateCodeBlocks ( markdown : string ) : void {
337
+ calculateCodeBlocks ( markdown ?: string ) : void {
338
+ if ( ! markdown ) {
339
+ return ;
340
+ }
338
341
if ( this . _currentProvider ?. id !== AccessibleViewProviderId . Chat ) {
339
342
return ;
340
343
}
@@ -391,10 +394,10 @@ export class AccessibleView extends Disposable {
391
394
this . _openerService . open ( URI . parse ( this . _currentProvider . options . readMoreUrl ) ) ;
392
395
}
393
396
394
- configureKeybindings ( ) : void {
397
+ configureKeybindings ( unassigned : boolean ) : void {
395
398
this . _inQuickPick = true ;
396
399
const provider = this . _updateLastProvider ( ) ;
397
- const items = provider ?. options ?. configureKeybindingItems ;
400
+ const items = unassigned ? provider ?. options ?. configureKeybindingItems : provider ?. options ?. configuredKeybindingItems ;
398
401
if ( ! items ) {
399
402
return ;
400
403
}
@@ -496,45 +499,39 @@ export class AccessibleView extends Disposable {
496
499
this . _accessibleViewGoToSymbolSupported . set ( this . _goToSymbolsSupported ( ) ? this . getSymbols ( ) ?. length ! > 0 : false ) ;
497
500
}
498
501
499
- private _render ( provider : AccesibleViewContentProvider , container : HTMLElement , showAccessibleViewHelp ?: boolean , updatedContent ?: string ) : IDisposable {
500
- this . _currentProvider = provider ;
501
- this . _accessibleViewCurrentProviderId . set ( provider . id ) ;
502
- const verbose = this . _verbosityEnabled ( ) ;
503
- const readMoreLink = provider . options . readMoreUrl ? localize ( "openDoc" , "\n\nOpen a browser window with more information related to accessibility<keybinding:{0}>." , AccessibilityCommandId . AccessibilityHelpOpenHelpLink ) : '' ;
504
- let disableHelpHint = '' ;
505
- if ( provider instanceof AccessibleContentProvider && provider . options . type === AccessibleViewType . Help && verbose ) {
506
- disableHelpHint = this . _getDisableVerbosityHint ( ) ;
502
+ private _updateContent ( provider : AccesibleViewContentProvider , updatedContent ?: string ) : void {
503
+ let content = updatedContent ?? provider . provideContent ( ) ;
504
+ if ( provider . options . type === AccessibleViewType . View ) {
505
+ this . _currentContent = content ;
506
+ return ;
507
507
}
508
- const accessibilitySupport = this . _accessibilityService . isScreenReaderOptimized ( ) ;
509
- let message = '' ;
510
- if ( provider . options . type === AccessibleViewType . Help ) {
511
- const turnOnMessage = (
512
- isMacintosh
513
- ? AccessibilityHelpNLS . changeConfigToOnMac
514
- : AccessibilityHelpNLS . changeConfigToOnWinLinux
515
- ) ;
516
- if ( accessibilitySupport && provider instanceof AccessibleContentProvider && provider . verbositySettingKey === AccessibilityVerbositySettingId . Editor ) {
517
- message = AccessibilityHelpNLS . auto_on ;
518
- message += '\n' ;
519
- } else if ( ! accessibilitySupport ) {
520
- message = AccessibilityHelpNLS . auto_off + '\n' + turnOnMessage ;
521
- message += '\n' ;
508
+ const readMoreLinkHint = this . _readMoreHint ( provider ) ;
509
+ const disableHelpHint = this . _disableVerbosityHint ( provider ) ;
510
+ const screenReaderModeHint = this . _screenReaderModeHint ( provider ) ;
511
+ const exitThisDialogHint = this . _exitDialogHint ( provider ) ;
512
+ let configureKbHint = '' ;
513
+ let configureAssignedKbHint = '' ;
514
+ const resolvedContent = resolveContentAndKeybindingItems ( this . _keybindingService , screenReaderModeHint + content + readMoreLinkHint + disableHelpHint + exitThisDialogHint ) ;
515
+ if ( resolvedContent ) {
516
+ content = resolvedContent . content . value ;
517
+ if ( resolvedContent . configureKeybindingItems ) {
518
+ provider . options . configureKeybindingItems = resolvedContent . configureKeybindingItems ;
519
+ configureKbHint = this . _configureUnassignedKbHint ( ) ;
522
520
}
523
- }
524
- const exitThisDialogHint = verbose && ! provider . options . position ? localize ( 'exit' , '\n\nExit this dialog (Escape).' ) : '' ;
525
- let content = updatedContent ?? provider . provideContent ( ) ;
526
- if ( provider . options . type === AccessibleViewType . Help ) {
527
- const resolvedContent = resolveContentAndKeybindingItems ( this . _keybindingService , content + readMoreLink + disableHelpHint + exitThisDialogHint ) ;
528
- if ( resolvedContent ) {
529
- content = resolvedContent . content . value ;
530
- if ( resolvedContent . configureKeybindingItems ) {
531
- provider . options . configureKeybindingItems = resolvedContent . configureKeybindingItems ;
532
- }
521
+ if ( resolvedContent . configuredKeybindingItems ) {
522
+ provider . options . configuredKeybindingItems = resolvedContent . configuredKeybindingItems ;
523
+ configureAssignedKbHint = this . _configureAssignedKbHint ( ) ;
533
524
}
534
525
}
535
- const newContent = message + content ;
536
- this . calculateCodeBlocks ( newContent ) ;
537
- this . _currentContent = newContent ;
526
+ this . _currentContent = content + configureKbHint + configureAssignedKbHint ;
527
+ }
528
+
529
+ private _render ( provider : AccesibleViewContentProvider , container : HTMLElement , showAccessibleViewHelp ?: boolean , updatedContent ?: string ) : IDisposable {
530
+ this . _currentProvider = provider ;
531
+ this . _accessibleViewCurrentProviderId . set ( provider . id ) ;
532
+ const verbose = this . _verbosityEnabled ( ) ;
533
+ this . _updateContent ( provider , updatedContent ) ;
534
+ this . calculateCodeBlocks ( this . _currentContent ) ;
538
535
this . _updateContextKeys ( provider , true ) ;
539
536
const widgetIsFocused = this . _editorWidget . hasTextFocus ( ) || this . _editorWidget . hasWidgetFocus ( ) ;
540
537
this . _getTextModel ( URI . from ( { path : `accessible-view-${ provider . id } ` , scheme : 'accessible-view' , fragment : this . _currentContent } ) ) . then ( ( model ) => {
@@ -708,7 +705,7 @@ export class AccessibleView extends Disposable {
708
705
accessibleViewHelpProvider = new AccessibleContentProvider (
709
706
lastProvider . id as AccessibleViewProviderId ,
710
707
{ type : AccessibleViewType . Help } ,
711
- ( ) => lastProvider . options . customHelp ? lastProvider ?. options . customHelp ( ) : this . _getAccessibleViewHelpDialogContent ( this . _goToSymbolsSupported ( ) ) ,
708
+ ( ) => lastProvider . options . customHelp ? lastProvider ?. options . customHelp ( ) : this . _accessibleViewHelpDialogContent ( this . _goToSymbolsSupported ( ) ) ,
712
709
( ) => {
713
710
this . _contextViewService . hideContextView ( ) ;
714
711
// HACK: Delay to allow the context view to hide #207638
@@ -720,7 +717,7 @@ export class AccessibleView extends Disposable {
720
717
accessibleViewHelpProvider = new ExtensionContentProvider (
721
718
lastProvider . id as AccessibleViewProviderId ,
722
719
{ type : AccessibleViewType . Help } ,
723
- ( ) => lastProvider . options . customHelp ? lastProvider ?. options . customHelp ( ) : this . _getAccessibleViewHelpDialogContent ( this . _goToSymbolsSupported ( ) ) ,
720
+ ( ) => lastProvider . options . customHelp ? lastProvider ?. options . customHelp ( ) : this . _accessibleViewHelpDialogContent ( this . _goToSymbolsSupported ( ) ) ,
724
721
( ) => {
725
722
this . _contextViewService . hideContextView ( ) ;
726
723
// HACK: Delay to allow the context view to hide #207638
@@ -735,9 +732,9 @@ export class AccessibleView extends Disposable {
735
732
}
736
733
}
737
734
738
- private _getAccessibleViewHelpDialogContent ( providerHasSymbols ?: boolean ) : string {
739
- const navigationHint = this . _getNavigationHint ( ) ;
740
- const goToSymbolHint = this . _getGoToSymbolHint ( providerHasSymbols ) ;
735
+ private _accessibleViewHelpDialogContent ( providerHasSymbols ?: boolean ) : string {
736
+ const navigationHint = this . _navigationHint ( ) ;
737
+ const goToSymbolHint = this . _goToSymbolHint ( providerHasSymbols ) ;
741
738
const toolbarHint = localize ( 'toolbar' , "Navigate to the toolbar (Shift+Tab)." ) ;
742
739
const chatHints = this . _getChatHints ( ) ;
743
740
@@ -766,20 +763,61 @@ export class AccessibleView extends Disposable {
766
763
localize ( 'runInTerminal' , " - Run the code block in the terminal<keybinding:'workbench.action.chat.runInTerminal>.\n" ) ] . join ( '\n' ) ;
767
764
}
768
765
769
- private _getNavigationHint ( ) : string {
766
+ private _navigationHint ( ) : string {
770
767
return localize ( 'accessibleViewNextPreviousHint' , "Show the next item<keybinding:{0}> or previous item<keybinding:{1}>." , AccessibilityCommandId . ShowNext , AccessibilityCommandId . ShowPrevious ) ;
771
768
}
772
769
773
- private _getDisableVerbosityHint ( ) : string {
774
- return localize ( 'acessibleViewDisableHint' , "\n\nDisable accessibility verbosity for this feature<keybinding:{0}>." , AccessibilityCommandId . DisableVerbosityHint ) ;
770
+ private _disableVerbosityHint ( provider : AccesibleViewContentProvider ) : string {
771
+ if ( provider . options . type === AccessibleViewType . Help && this . _verbosityEnabled ( ) ) {
772
+ return localize ( 'acessibleViewDisableHint' , "\n\nDisable accessibility verbosity for this feature<keybinding:{0}>." , AccessibilityCommandId . DisableVerbosityHint ) ;
773
+ }
774
+ return '' ;
775
775
}
776
776
777
- private _getGoToSymbolHint ( providerHasSymbols ?: boolean ) : string | undefined {
777
+ private _goToSymbolHint ( providerHasSymbols ?: boolean ) : string | undefined {
778
778
if ( ! providerHasSymbols ) {
779
779
return ;
780
780
}
781
781
return localize ( 'goToSymbolHint' , 'Go to a symbol<keybinding:{0}>.' , AccessibilityCommandId . GoToSymbol ) ;
782
782
}
783
+
784
+ private _configureUnassignedKbHint ( ) : string {
785
+ const configureKb = this . _keybindingService . lookupKeybinding ( AccessibilityCommandId . AccessibilityHelpConfigureKeybindings ) ?. getAriaLabel ( ) ;
786
+ const keybindingToConfigureQuickPick = configureKb ? '(' + configureKb + ')' : 'by assigning a keybinding to the command Accessibility Help Configure Keybindings.' ;
787
+ return localize ( 'configureKb' , '\n\nConfigure keybindings for commands that lack them {0}.' , keybindingToConfigureQuickPick ) ;
788
+ }
789
+
790
+ private _configureAssignedKbHint ( ) : string {
791
+ const configureKb = this . _keybindingService . lookupKeybinding ( AccessibilityCommandId . AccessibilityHelpConfigureAssignedKeybindings ) ?. getAriaLabel ( ) ;
792
+ const keybindingToConfigureQuickPick = configureKb ? '(' + configureKb + ')' : 'by assigning a keybinding to the command Accessibility Help Configure Assigned Keybindings.' ;
793
+ return localize ( 'configureKbAssigned' , '\n\nConfigure keybindings for commands that already have assignments {0}.' , keybindingToConfigureQuickPick ) ;
794
+ }
795
+
796
+ private _screenReaderModeHint ( provider : AccesibleViewContentProvider ) : string {
797
+ const accessibilitySupport = this . _accessibilityService . isScreenReaderOptimized ( ) ;
798
+ let screenReaderModeHint = '' ;
799
+ const turnOnMessage = (
800
+ isMacintosh
801
+ ? AccessibilityHelpNLS . changeConfigToOnMac
802
+ : AccessibilityHelpNLS . changeConfigToOnWinLinux
803
+ ) ;
804
+ if ( accessibilitySupport && provider . id === AccessibleViewProviderId . Editor ) {
805
+ screenReaderModeHint = AccessibilityHelpNLS . auto_on ;
806
+ screenReaderModeHint += '\n' ;
807
+ } else if ( ! accessibilitySupport ) {
808
+ screenReaderModeHint = AccessibilityHelpNLS . auto_off + '\n' + turnOnMessage ;
809
+ screenReaderModeHint += '\n' ;
810
+ }
811
+ return screenReaderModeHint ;
812
+ }
813
+
814
+ private _exitDialogHint ( provider : AccesibleViewContentProvider ) : string {
815
+ return this . _verbosityEnabled ( ) && ! provider . options . position ? localize ( 'exit' , '\n\nExit this dialog (Escape).' ) : '' ;
816
+ }
817
+
818
+ private _readMoreHint ( provider : AccesibleViewContentProvider ) : string {
819
+ return provider . options . readMoreUrl ? localize ( "openDoc" , "\n\nOpen a browser window with more information related to accessibility<keybinding:{0}>." , AccessibilityCommandId . AccessibilityHelpOpenHelpLink ) : '' ;
820
+ }
783
821
}
784
822
785
823
export class AccessibleViewService extends Disposable implements IAccessibleViewService {
@@ -800,8 +838,8 @@ export class AccessibleViewService extends Disposable implements IAccessibleView
800
838
}
801
839
this . _accessibleView . show ( provider , undefined , undefined , position ) ;
802
840
}
803
- configureKeybindings ( ) : void {
804
- this . _accessibleView ?. configureKeybindings ( ) ;
841
+ configureKeybindings ( unassigned : boolean ) : void {
842
+ this . _accessibleView ?. configureKeybindings ( unassigned ) ;
805
843
}
806
844
openHelpLink ( ) : void {
807
845
this . _accessibleView ?. openHelpLink ( ) ;
0 commit comments