From 167df6c6d4c63b3f69d828cfe4185ca6af6ac194 Mon Sep 17 00:00:00 2001 From: Sebastian Balcerowiak Date: Tue, 5 Dec 2023 01:46:34 +0100 Subject: [PATCH] Add largeFileModeThreshold for Textmate --- src/config-schema.js | 7 +++++++ src/text-mate-language-mode.js | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/config-schema.js b/src/config-schema.js index 29108d6a96..96961b0f05 100644 --- a/src/config-schema.js +++ b/src/config-schema.js @@ -616,6 +616,13 @@ const configSchema = { default: true, description: 'Add multiple cursors when pressing the Ctrl key (Command key on macOS) and clicking the editor.' + }, + largeFileModeThreshold: { + type: 'int', + default: 2 * 1024 * 1024, + minimum: 0, + description: + 'Set threshold number of characters to activate large file mode' } } } diff --git a/src/text-mate-language-mode.js b/src/text-mate-language-mode.js index aa1b52c9a2..051b0f1d7e 100644 --- a/src/text-mate-language-mode.js +++ b/src/text-mate-language-mode.js @@ -30,12 +30,12 @@ class TextMateLanguageMode { this.buffer = params.buffer; this.largeFileMode = params.largeFileMode; this.config = params.config; + this.grammar = params.grammar || NullGrammar; + this.largeFileModeThreshold = atom.config.get('largeFileModeThreshold', {scope:this.grammar.scopeName}) this.largeFileMode = params.largeFileMode != null ? params.largeFileMode - : this.buffer.buffer.getLength() >= 2 * 1024 * 1024; - - this.grammar = params.grammar || NullGrammar; + : this.buffer.buffer.getLength() >= this.largeFileModeThreshold; this.rootScopeDescriptor = new ScopeDescriptor({ scopes: [this.grammar.scopeName] });