Extract workspace editor logic into composable hooks and modular breadcrumb components#49
Merged
rushabhcodes merged 1 commit intoJul 19, 2026
Conversation
…dcrumb components - Add useWorkspaceModelManager, useWorkspaceNavigation, useDocumentSymbols, and useWorkspacePalettes hooks extracted from WorkspaceCodeEditor - Split Breadcrumbs into BreadcrumbSegment, FileTreeMenu, and SymbolMenuItems under src/components/breadcrumbs/ - Convert multi-parameter callbacks to named-parameter objects per the handbook style guide (e.g. onReplace) - Reorganize the test suite to one test per file in per-module directories, with shared setup hoisted into tests/fixtures/ No public API changes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
|
Thank you for your contribution! 🎉 PR Rating: ⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
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 changed
WorkspaceCodeEditor(previously ~600 lines) andBreadcrumbs(~450 lines) mixedmodel management, navigation, keyboard handling, and rendering in single files.
This PR decomposes them into focused, independently testable units:
New hooks (
src/hooks/)useWorkspaceModelManager— owns the Monaco model manager: keeps a livemodel per text file so the TypeScript language service resolves cross-file
imports project-wide, and defers TS worker-graph initialization until the
workspace settles.
useWorkspaceNavigation— cross-file "go to definition" routed throughonFileSelect, model swapping with per-file cursor/scroll state preservation,and pending-reveal application when the target file becomes active.
useDocumentSymbols— tracks the active model's symbol outline and thesymbol path containing the cursor, refetching on content changes.
useWorkspacePalettes— mutually exclusive Quick Open / workspace searchstate plus the global Ctrl/Cmd+P and Ctrl/Cmd+Shift+F shortcuts.
Breadcrumbs modularization (
src/components/breadcrumbs/)BreadcrumbSegment,FileTreeMenu(with fuzzy file search), andSymbolMenuItemsare now standalone components; sibling lists per path depthare computed in a single tree walk so cursor-move re-renders stay cheap.
API consistency
(e.g.
onReplace({ matches, replacement, useRegex })), keeping functionsignatures at two parameters or fewer per the handbook style guide.
Test suite: one test per file
The suite (57 tests) is reorganized so each file contains exactly one
test(),grouped in per-module directories (
tests/workspaceSearch/,tests/quickOpen/,tests/tsciPackageSupport/, …) with shared setup hoisted intotests/fixtures/.Assertions are unchanged.
Breaking changes
None. The public exports (
WorkspaceCodeEditorProps,WorkspaceCodeEditorHandle,EditorFile, monaco utilities) are untouched; the only changed signature(
WorkspaceSearchProps.onReplace) is internal and not exported from the packageentry point.
Verification
bun run typecheck— cleanbun test— 57 pass / 0 fail across 57 filesbiome format— applied