Lazy-load the file tree, decouple the workspace index#8
Open
evanklem wants to merge 1 commit into
Open
Conversation
The explorer rendered as "only dot folders / empty" when a project rooted a large early-sorted directory (e.g. a fresh .venv with ~11k files). The eager whole-tree walk in list_dir capped at 2500 files with a hard break, and because entries sort folders-first/lowercased, an oversized early subtree exhausted the budget and every sibling after it was dropped. .venv and the python cache dirs were also absent from the ignore list. Switch to VS Code-convention lazy resolution and split the two concerns the editor panel had conflated: - fs_list_dir(path): one level only, no cap; folders come back collapsed and resolve their children on expand. fs_list_files(): complete, gitignore- aware index via `rg --files` for quick-open and Monaco cross-file types, which previously rode on the same capped tree walk. - venv/__pycache__/.mypy_cache/.pytest_cache/.ruff_cache added to the built-in ignore list. - editor.listDir / editor.listFiles plumbed through the host RPC adapter, SDK client, and Tauri bridge; mapped under the editor.read permission. - Shared FileTree gains opt-in lazy onExpand (eager KB usage unchanged); the editor panel resolves children on expand, preserves expansion across create/delete/rename refreshes, and feeds quick-open/Monaco from the decoupled index. Default-open skips binary assets the complete index now surfaces. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Fixes the explorer rendering as “only dot folders” or appearing empty when a project root contains a large, early-sorted directory, such as a fresh
.venvwith roughly 11k files.Previously, the eager recursive listing was capped at 2,500 files. If an oversized early subtree exhausted that budget, later entries were dropped.
.venvand common Python cache/build directories were also missing from the ignore list.Closes #4
This change narrows the resolution path and separates two concerns that the explorer panel had conflated:
fs_list_dir(path)lists one directory level only. This is used for collapsed and lazily expanded explorer nodes.fs_list_files()returns a complete project file index usinggit ls-filesfor quick-open and Monaco resolution. These previously rode on the same recursive listing path.Additional changes:
venv,__pycache__,.mypy_cache, and.ruff_cacheto the ignore list.editor.listDirandeditor.listFilesthrough the RPC adapter and SDK under the existingeditor.readpermission.FileTreewith opt-in lazyonExpandloading while leaving existing eager callers unchanged.How to test
Open a project that contains a large early-sorted directory, such as a Python project with a populated
.venv.Confirm the explorer shows the full project tree and that ignored directories such as
.venv,venv,__pycache__,.mypy_cache, and.ruff_cacheare not shown.Expand folders and confirm children resolve on demand.
Refresh the file tree and confirm expansion state is preserved.
Confirm quick-open and Monaco file resolution still work.
Run:
npm run typecheckcd src-tauri && cargo clippy --no-deps -- -D warningscd src-tauri && cargo testChecklist
npm run typecheckpassescd src-tauri && cargo clippy --no-deps -- -D warningspassescd src-tauri && cargo testpasses