Skip to content

Commit 83ce87a

Browse files
committed
Performance: only check old_mode if needed
1 parent 6f34d91 commit 83ce87a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/jupyterlab-lsp/src/features/syntax_highlighting.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ export class CMSyntaxHighlighting extends CodeMirrorIntegration {
7777
continue;
7878
}
7979

80-
let old_mode = editor.getOption('mode');
81-
8280
// change the mode if the majority of the code is the foreign code
8381
if (coverage > this.settings.composite.foreignCodeThreshold) {
8482
editors_with_current_highlight.add(ce_editor);
83+
let old_mode = editor.getOption('mode');
8584
if (old_mode != mode.mime) {
8685
editor.setOption('mode', mode.mime);
8786
}

0 commit comments

Comments
 (0)