Skip to content

Conversation

@asiloisad
Copy link
Contributor

Add a new core.largeFileThreshold config setting to make the TextMate grammar large file mode threshold configurable.

Previously, the threshold was hardcoded at 2MB. Files larger than this would open with syntax highlighting disabled (large file mode). This PR allows users to customize this threshold in Settings.

Changes

  • Add core.largeFileThreshold config option in config-schema.js (default: 2MB)
  • Update text-mate-language-mode.js to read threshold from config
  • Add spec tests for the new config behavior

Usage

In Settings → Core → Large File Threshold:

  • Default: 2 (2MB, preserves existing behavior)
  • Increase to allow syntax highlighting for larger files (e.g., 20 for 20MB)
  • Set to 0 to never auto-enable large file mode

@confused-Techie
Copy link
Member

Thanks a ton for your contribution! I think this is a great idea, I'm just re-running the tests so we can make sure everything is happy, but also thanks for making sure to include new tests here!

@savetheclocktower
Copy link
Contributor

My only feedback here is that we might want to make this editor.largeFileThreshold instead ofcore.largeFileThreshold. Two reasons:

  1. Editor-related settings make more sense to me under the editor namespace.
  2. Anything that we think a user might want to customize on a per-language basis should probably go into editor so that we can more easily display that customization opportunity in the GUI. (A whitelist of editor settings is displayed on a grammar package’s settings page for exactly this reason.)

I regret, for instance, that the Atom folks added the useTreeSitterParsers setting under core rather than editor.

If we do this, we could also go one step further and make sure that the setting is checked on a per-language basis by passing a scope selector into atom.config.get. I am not asking for this as part of this PR; I think reason 1 is enough to want to name this editor.largeFileThreshold. But I also would not complain if it were added to this PR.

@asiloisad
Copy link
Contributor Author

asiloisad commented Feb 7, 2026

I agree with the proposed changes.

  1. Renamed core.largeFileThresholdeditor.largeFileThreshold.
  2. Added per-language scoping — the config is now read with { scope: this.rootScopeDescriptor }.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants