Skip to content

Commit

Permalink
Performance: only check old_mode if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Oct 25, 2020
1 parent 6f34d91 commit 83ce87a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/jupyterlab-lsp/src/features/syntax_highlighting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ export class CMSyntaxHighlighting extends CodeMirrorIntegration {
continue;
}

let old_mode = editor.getOption('mode');

// change the mode if the majority of the code is the foreign code
if (coverage > this.settings.composite.foreignCodeThreshold) {
editors_with_current_highlight.add(ce_editor);
let old_mode = editor.getOption('mode');
if (old_mode != mode.mime) {
editor.setOption('mode', mode.mime);
}
Expand Down

0 comments on commit 83ce87a

Please sign in to comment.