Skip to content

Commit

Permalink
properly check picked formatter, #71988
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Apr 9, 2019
1 parent 4f02d0a commit 30218a0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ registerEditorAction(class FormatDocumentMultipleAction extends EditorAction {
const model = editor.getModel();
const provider = getRealAndSyntheticDocumentFormattersOrdered(model);
const pick = await instaService.invokeFunction(showFormatterPick, model, provider);
if (pick) {
if (typeof pick === 'number') {
await instaService.invokeFunction(formatDocumentWithProvider, provider[pick], editor, FormattingMode.Explicit, CancellationToken.None);
}
logFormatterTelemetry(telemetryService, 'document', provider, typeof pick === 'number' && provider[pick] || undefined);
Expand Down Expand Up @@ -291,7 +291,7 @@ registerEditorAction(class FormatSelectionMultipleAction extends EditorAction {

const provider = DocumentRangeFormattingEditProviderRegistry.ordered(model);
const pick = await instaService.invokeFunction(showFormatterPick, model, provider);
if (pick) {
if (typeof pick === 'number') {
await instaService.invokeFunction(formatDocumentRangeWithProvider, provider[pick], editor, range, CancellationToken.None);
}

Expand Down

0 comments on commit 30218a0

Please sign in to comment.