Skip to content

Commit

Permalink
Add largeFileModeThreshold for Textmate
Browse files Browse the repository at this point in the history
  • Loading branch information
asiloisad committed Dec 5, 2023
1 parent c16743e commit 167df6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/config-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/text-mate-language-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
});
Expand Down

0 comments on commit 167df6c

Please sign in to comment.