Skip to content

Commit 6023a85

Browse files
committed
Don't format if the notebook type is undetermined
In the event that `getNotebookType()` is null, an error is shown from within `getFormattersToUse()` because it can't determine the list of default formatters. This makes sense when using an unconfigured language, but in the event of null, this seems to mean the notebook isn't fully initialized and formatting shouldn't even be attempted.
1 parent 55a9d04 commit 6023a85

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/formatter.ts

+4
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ export class JupyterlabNotebookCodeFormatter extends JupyterlabCodeFormatter {
238238
}
239239
try {
240240
this.working = true;
241+
if (this.getNotebookType() === null) {
242+
this.working = false;
243+
return;
244+
}
241245
const selectedCells = this.getCodeCells(selectedOnly, notebook);
242246
if (selectedCells.length === 0) {
243247
this.working = false;

0 commit comments

Comments
 (0)