提交 56304bd6 编写于 作者: M Matt Bierner

Remove some casts

This cast was hiding a potential bug where extensionId was being used as a string
上级 f2397049
......@@ -126,10 +126,10 @@ class DefaultFormatter extends Disposable implements IWorkbenchContribution {
}
private async _pickAndPersistDefaultFormatter<T extends FormattingEditProvider>(formatter: T[], document: ITextModel): Promise<T | undefined> {
const picks = formatter.map((formatter, index) => {
return <IIndexedPick>{
const picks = formatter.map((formatter, index): IIndexedPick => {
return {
index,
label: formatter.displayName || formatter.extensionId || '?',
label: formatter.displayName || (formatter.extensionId ? formatter.extensionId.value : '?'),
description: formatter.extensionId && formatter.extensionId.value
};
});
......@@ -203,7 +203,7 @@ async function showFormatterPick(accessor: ServicesAccessor, model: ITextModel,
const picks = formatters.map((provider, index) => {
const isDefault = ExtensionIdentifier.equals(provider.extensionId, defaultFormatter);
const pick = <IIndexedPick>{
const pick: IIndexedPick = {
index,
label: provider.displayName || '',
description: isDefault ? nls.localize('def', "(default)") : undefined,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册