Skip to content

Commit 7efe340

Browse files
committed
Address review comments
1 parent 4685963 commit 7efe340

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

packages/console/src/monaco/MonacoProviders.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,18 @@ class MonacoProviders extends PureComponent<
251251
};
252252
}
253253

254-
const diagnostics = MonacoProviders.getDiagnostics(model)
255-
.filter(d => d.code != null) // Syntax errors have no code and can't be fixed/disabled
256-
.filter(d => {
257-
const diagnosticRange = new monaco.Range(
258-
d.location.row,
259-
d.location.column,
260-
d.end_location.row,
261-
d.end_location.column
262-
);
263-
return diagnosticRange.intersectRanges(range);
264-
});
254+
const diagnostics = MonacoProviders.getDiagnostics(model).filter(d => {
255+
const diagnosticRange = new monaco.Range(
256+
d.location.row,
257+
d.location.column,
258+
d.end_location.row,
259+
d.end_location.column
260+
);
261+
return (
262+
d.code != null && // Syntax errors have no code and can't be fixed/disabled
263+
diagnosticRange.intersectRanges(range)
264+
);
265+
});
265266

266267
const fixActions: monaco.languages.CodeAction[] = diagnostics
267268
.filter(({ fix }) => fix != null)
@@ -274,7 +275,6 @@ class MonacoProviders extends PureComponent<
274275
title = `Fix ${d.code}`;
275276
}
276277
}
277-
const b = 4;
278278
return {
279279
title,
280280
id: `fix-${d.code}`,
@@ -314,6 +314,7 @@ class MonacoProviders extends PureComponent<
314314
const disableLineActions: monaco.languages.CodeAction[] = diagnostics
315315
.map(d => {
316316
if (d.code == null) {
317+
// The nulls are already filtered out, but TS doesn't know that
317318
return [];
318319
}
319320
const line = model.getLineContent(d.location.row);

0 commit comments

Comments
 (0)