You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Large-file threshold was defined in two places (1 MB vs 100 MB), causing inconsistent handlingΒ #2540
The "large file" threshold β which decides whether a file loads eagerly (full line index, LSP, exact scrollbar) or lazily (chunked, no line index β byte-offset gutter/status, LSP skipped) β was defined by two competing constants with different values, and several sites didn't honor the user setting. As a result the effective threshold depended on which code path you hit.
Symptom
Opening a file between the two thresholds β e.g. jumping to a definition inside slangd's dumped core builtin module (~2.1 MB) β put the buffer into large-file mode: the gutter and status bar showed byte offsets instead of line numbers ("Byte 126437" rather than "Ln 4262, Col 25"), and LSP was disabled, even though 2 MB is a perfectly reasonable "small" file.
Root cause
Definition
Value
Role
config::LARGE_FILE_THRESHOLD_BYTES
1 MB
config default β but also hardcoded directly in some production sites
buffer::DEFAULT_LARGE_FILE_THRESHOLD
100 MB
second, divergent constant: the load-path == 0 fallback and the (dead) check_large_file_encoding
Plus:
check_large_file_encoding was a pub fn with no production caller (only a test) that carried the 100 MB value; the real encoding-confirmation flow is driven by load_large_file_internal.
composite_buffer_actions passed the constant instead of the config value.
wasm had its own third 100 MB copy.
highlighter::MAX_PARSE_BYTES (a viewport parse budget β a distinct concern) borrowed the file-threshold constant.
So editor.large_file_threshold_bytes did not actually control the whole chain, and the default was an aggressively low 1 MB.
Fix
Consolidated to a single source of truth: editor.large_file_threshold_bytes, whose only constant is its default, raised to 10 MB. Removed the 100 MB duplicate, the == 0 fallback, and the dead check_large_file_encoding; routed the production bypass through the config value; gave the highlighter its own budget constant; regenerated plugins/config-schema.json.
Verified: go-to-definition into the 2.1 MB core builtin now opens with line numbers ("Ln 4262, Col 25").
Fixed on branch claude/slangd-lsp-testing-372g8o (commits 6e24fab, 57338e2).
Follow-up
The large_file_threshold parameter is still threaded through in-memory constructors that ignore it β tracked separately as tech debt.
Activity
Fix large-file e2e tests for the 10 MB threshold
Fix large-file e2e tests for the 10 MB threshold
Run #54: large-file 10MB threshold (#2540) core PASS + filed #2596 (fβ¦