Skip to content

Commit 9330718

Browse files
authored
1 parent a1a29cf commit 9330718

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

src/vs/workbench/contrib/notebook/browser/notebookOptions.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -284,28 +284,33 @@ export class NotebookOptions extends Disposable {
284284
return;
285285
}
286286

287-
const options = this.codeEditorService.resolveDecorationOptions(e, true);
288-
if (options.afterContentClassName || options.beforeContentClassName) {
289-
const cssRules = this.codeEditorService.resolveDecorationCSSRules(e);
290-
if (cssRules !== null) {
291-
for (let i = 0; i < cssRules.length; i++) {
292-
// The following ways to index into the list are equivalent
293-
if (
294-
((cssRules[i] as CSSStyleRule).selectorText.endsWith('::after') || (cssRules[i] as CSSStyleRule).selectorText.endsWith('::after'))
295-
&& (cssRules[i] as CSSStyleRule).cssText.indexOf('top:') > -1
296-
) {
297-
// there is a `::before` or `::after` text decoration whose position is above or below current line
298-
// we at least make sure that the editor top padding is at least one line
299-
const editorOptions = this.configurationService.getValue<IEditorOptions>('editor');
300-
updateEditorTopPadding(BareFontInfo.createFromRawSettings(editorOptions, PixelRatio.getInstance(this.targetWindow).value).lineHeight + 2);
301-
decorationTriggeredAdjustment = true;
302-
break;
287+
try {
288+
const options = this.codeEditorService.resolveDecorationOptions(e, true);
289+
if (options.afterContentClassName || options.beforeContentClassName) {
290+
const cssRules = this.codeEditorService.resolveDecorationCSSRules(e);
291+
if (cssRules !== null) {
292+
for (let i = 0; i < cssRules.length; i++) {
293+
// The following ways to index into the list are equivalent
294+
if (
295+
((cssRules[i] as CSSStyleRule).selectorText.endsWith('::after') || (cssRules[i] as CSSStyleRule).selectorText.endsWith('::after'))
296+
&& (cssRules[i] as CSSStyleRule).cssText.indexOf('top:') > -1
297+
) {
298+
// there is a `::before` or `::after` text decoration whose position is above or below current line
299+
// we at least make sure that the editor top padding is at least one line
300+
const editorOptions = this.configurationService.getValue<IEditorOptions>('editor');
301+
updateEditorTopPadding(BareFontInfo.createFromRawSettings(editorOptions, PixelRatio.getInstance(this.targetWindow).value).lineHeight + 2);
302+
decorationTriggeredAdjustment = true;
303+
break;
304+
}
303305
}
304306
}
305307
}
308+
309+
decorationCheckSet.add(e);
310+
} catch (_ex) {
311+
// do not throw and break notebook
306312
}
307313

308-
decorationCheckSet.add(e);
309314
};
310315
this._register(this.codeEditorService.onDecorationTypeRegistered(onDidAddDecorationType));
311316
this.codeEditorService.listDecorationTypes().forEach(onDidAddDecorationType);

0 commit comments

Comments
 (0)