提交 64a4965b 编写于 作者: A Acid147

Address feedback

上级 326ef1bd
......@@ -201,22 +201,29 @@ async function showFormatterPick(accessor: ServicesAccessor, model: ITextModel,
const overrides = { resource: model.uri, overrideIdentifier: model.getModeId() };
const defaultFormatter = configService.getValue<string>(DefaultFormatter.configName, overrides);
let autoFocusPick;
const picks = formatters.map((provider, index) => {
return <IIndexedPick>{
const isDefault = ExtensionIdentifier.equals(provider.extensionId, defaultFormatter);
const pick = <IIndexedPick>{
index,
label: provider.displayName || '',
description: ExtensionIdentifier.equals(provider.extensionId, defaultFormatter) ? nls.localize('def', "(default)") : undefined,
description: isDefault ? nls.localize('def', "(default)") : undefined,
};
});
// auto focus the default formatter
let autoFocusItem = picks.filter((pick) => pick.description)[0];
if (isDefault) {
// autofocus default pick
autoFocusPick = pick;
}
return pick;
});
const configurePick: IQuickPickItem = {
label: nls.localize('config', "Configure Default Formatter...")
};
const pick = await quickPickService.pick([...picks, { type: 'separator' }, configurePick], { placeHolder: nls.localize('format.placeHolder', "Select a formatter"), activeItem: autoFocusItem });
const pick = await quickPickService.pick([...picks, { type: 'separator' }, configurePick], { placeHolder: nls.localize('format.placeHolder', "Select a formatter"), activeItem: autoFocusPick });
if (!pick) {
// dismissed
return undefined;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册