Skip to content

Commit 3686922

Browse files
committed
Fix performance issues caused by lazy syntax highlight implementation
1 parent 370f889 commit 3686922

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ export class CMSyntaxHighlighting extends CodeMirrorIntegration {
7575

7676
// change the mode if the majority of the code is the foreign code
7777
if (coverage > this.settings.composite.foreignCodeThreshold) {
78-
editor.setOption('mode', mode.mime);
78+
let old_mode = editor.getOption('mode');
79+
if (old_mode != mode.mime) {
80+
editor.setOption('mode', mode.mime);
81+
}
7982
}
8083
}
8184
}

0 commit comments

Comments
 (0)