Skip to content

[codex] cap indexing to first 10k lines per file - #480

Merged
Feel-ix-343 merged 1 commit into
Feel-ix-343:mainfrom
exa-labs:devin/1782530839-cap-index-10k-lines
Jun 29, 2026
Merged

[codex] cap indexing to first 10k lines per file#480
Feel-ix-343 merged 1 commit into
Feel-ix-343:mainfrom
exa-labs:devin/1782530839-cap-index-10k-lines

Conversation

@Feel-ix-343

Copy link
Copy Markdown
Owner

Summary

Caps markdown file indexing to the first 10,000 lines per file at the MDFile::new chokepoint. Vault construction and open-file updates still keep the full file text in Rope, so editor operations can continue to work with the full buffer while expensive regex-based reference/index parsing avoids pathological long-file stalls.

Why

MDFile::new is used by both full vault scans and file updates, and it runs reference, heading, tag, footnote, link-reference, indexed-block, metadata, and code-block parsing across the input text. Very large markdown files can stall the LSP during those passes. Capping the parser input in one place bounds that work without changing the stored file contents.

Validation

  • cargo fmt --check
  • cargo test (77 passed)

Added regression coverage that verifies content on line 10,000 is indexed, content after line 10,000 is ignored by MDFile, and Vault::update_vault still stores the full text in the rope.

@Feel-ix-343
Feel-ix-343 marked this pull request as ready for review June 29, 2026 04:41
@Feel-ix-343
Feel-ix-343 merged commit 282c8de into Feel-ix-343:main Jun 29, 2026
3 of 4 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread src/vault/mod.rs
Comment on lines +24 to +31
const MAX_INDEXED_LINES: usize = 10_000;

fn indexed_text(text: &str) -> &str {
match text.match_indices('\n').nth(MAX_INDEXED_LINES - 1) {
Some((idx, _)) => &text[..idx + 1],
None => text,
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Completion features silently degrade for files exceeding 10K lines

After this change, go-to-definition, references, heading completions, tag completions, and indexed block features will silently stop working for content beyond line 10,000. The rope still stores the full text (verified by the update_vault_keeps_full_text_in_rope test at line 3385), so preview/hover features using select_line will still work for all lines, creating an inconsistency where a user can see content but not navigate to or from references within it. There is no user-facing notification or log message when truncation occurs. Whether this is acceptable depends on the use case — it may be worth logging when a file is truncated.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant