Skip to content

Commit 0cd6e01

Browse files
committed
1 parent 26ed878 commit 0cd6e01

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

src/vs/editor/contrib/suggest/browser/suggestWidget.ts

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,34 @@ export class SuggestWidget implements IDisposable {
224224
mouseSupport: false,
225225
accessibilityProvider: {
226226
getRole: () => 'option',
227+
getWidgetAriaLabel: () => nls.localize('suggest', "Suggest"),
228+
getWidgetRole: () => 'listbox',
227229
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;
238245
}
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);
239254
},
240-
getWidgetAriaLabel: () => nls.localize('suggest', "Suggest"),
241-
getWidgetRole: () => 'listbox'
242255
}
243256
});
244257

0 commit comments

Comments
 (0)