Skip to content

Commit 56304bd

Browse files
committed
Remove some casts
This cast was hiding a potential bug where extensionId was being used as a string
1 parent f239704 commit 56304bd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/vs/workbench/contrib/format/browser/formatActionsMultiple.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ class DefaultFormatter extends Disposable implements IWorkbenchContribution {
126126
}
127127

128128
private async _pickAndPersistDefaultFormatter<T extends FormattingEditProvider>(formatter: T[], document: ITextModel): Promise<T | undefined> {
129-
const picks = formatter.map((formatter, index) => {
130-
return <IIndexedPick>{
129+
const picks = formatter.map((formatter, index): IIndexedPick => {
130+
return {
131131
index,
132-
label: formatter.displayName || formatter.extensionId || '?',
132+
label: formatter.displayName || (formatter.extensionId ? formatter.extensionId.value : '?'),
133133
description: formatter.extensionId && formatter.extensionId.value
134134
};
135135
});
@@ -203,7 +203,7 @@ async function showFormatterPick(accessor: ServicesAccessor, model: ITextModel,
203203

204204
const picks = formatters.map((provider, index) => {
205205
const isDefault = ExtensionIdentifier.equals(provider.extensionId, defaultFormatter);
206-
const pick = <IIndexedPick>{
206+
const pick: IIndexedPick = {
207207
index,
208208
label: provider.displayName || '',
209209
description: isDefault ? nls.localize('def', "(default)") : undefined,

0 commit comments

Comments
 (0)