Skip to content

doc(lsp): the climb to the root is a measured cost, kept on purpose - #367

Merged
cmj0121 merged 1 commit into
mainfrom
doc/364-server-climb
Oct 14, 2026
Merged

cmj0121 merged 1 commit into
mainfrom
doc/364-server-climb

Conversation

@cmj0121

@cmj0121 cmj0121 commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Closes #364.

What

A comment, no behaviour change. load_buffer now says that a buffer whose ancestors hold no source climbs to the
filesystem root, why that is kept, what it costs, and where a bound would come from.

Why not bound the climb

The issue offered two ways out; this takes the second. A bound needs something that says where a project ends,
and neither candidate exists: there is no manifest (docs/runtime/package.md's package layer is [not yet]), and
the server reads no rootUri / workspaceFolders from the client. A .git marker would not help the case that
prompted this either — a scratch file in $TMPDIR has none above it.

Measured

macOS, $TMPDIR holding 43,653 entries, bin/zerg built from main after #361:

listing of $TMPDIR real
first (cold) 0.63 s
second 0.04 s
third 0.03 s

Before #361 the same listing was quadratic and make lsp failed on this machine; after it, the gate passes.

Verified

build, fixpoint, lint, fmt-self, docs-links, each run alone and read. The rest of the board was not run
for a comment-only change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N8jd1oK2orM6diHxhvWhC7

    A buffer whose ancestors hold no source makes the server list every
    directory up to the root, $TMPDIR included, on each check. Nothing on
    the way marks where a project ends: there is no manifest and the
    server reads no workspace root. Since zrt_listdir sorts once (#361) a
    level costs one readdir and one sort, so load_buffer now says that,
    and where a bound belongs when either missing thing exists.

    Closes #364.
@cmj0121
cmj0121 merged commit 4c6c188 into main Oct 14, 2026
8 checks passed
@cmj0121
cmj0121 deleted the doc/364-server-climb branch October 14, 2026 09:45
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.

the language server lists every ancestor of a buffer whose project holds no source, $TMPDIR included

1 participant