@@ -224,21 +224,34 @@ export class SuggestWidget implements IDisposable {
224
224
mouseSupport : false ,
225
225
accessibilityProvider : {
226
226
getRole : ( ) => 'option' ,
227
+ getWidgetAriaLabel : ( ) => nls . localize ( 'suggest' , "Suggest" ) ,
228
+ getWidgetRole : ( ) => 'listbox' ,
227
229
getAriaLabel : ( item : CompletionItem ) => {
228
- if ( item . isResolved && this . _isDetailsVisible ( ) ) {
229
- const { documentation, detail } = item . completion ;
230
- const docs = strings . format (
231
- '{0}{1}' ,
232
- detail || '' ,
233
- documentation ? ( typeof documentation === 'string' ? documentation : documentation . value ) : '' ) ;
234
-
235
- return nls . localize ( 'ariaCurrenttSuggestionReadDetails' , "{0}, docs: {1}" , item . textLabel , docs ) ;
236
- } else {
237
- return item . textLabel ;
230
+
231
+ let label = item . textLabel ;
232
+ if ( typeof item . completion . label !== 'string' ) {
233
+ const { detail, description } = item . completion . label ;
234
+ if ( detail && description ) {
235
+ label = nls . localize ( 'label.full' , '{0}{1}, {2}' , label , detail , description ) ;
236
+ } else if ( detail ) {
237
+ label = nls . localize ( 'label.detail' , '{0}{1}' , label , detail ) ;
238
+ } else if ( description ) {
239
+ label = nls . localize ( 'label.desc' , '{0}, {1}' , label , description ) ;
240
+ }
241
+ }
242
+
243
+ if ( ! item . isResolved || ! this . _isDetailsVisible ( ) ) {
244
+ return label ;
238
245
}
246
+
247
+ const { documentation, detail } = item . completion ;
248
+ const docs = strings . format (
249
+ '{0}{1}' ,
250
+ detail || '' ,
251
+ documentation ? ( typeof documentation === 'string' ? documentation : documentation . value ) : '' ) ;
252
+
253
+ return nls . localize ( 'ariaCurrenttSuggestionReadDetails' , "{0}, docs: {1}" , label , docs ) ;
239
254
} ,
240
- getWidgetAriaLabel : ( ) => nls . localize ( 'suggest' , "Suggest" ) ,
241
- getWidgetRole : ( ) => 'listbox'
242
255
}
243
256
} ) ;
244
257
0 commit comments