Skip to content

Commit 47d08be

Browse files
refactor(Sky): Extract inline bridge handlers into dedicated module files
Replace ~2500 lines of inline handler registrations in `Bridge.ts` with dynamic imports to four new dedicated module files, each owning a cohesive set of IPC channels: - `InstallWebview.ts`: Webview create/set-html/updateView/postMessage, WebviewView registration with workbench `IWebviewViewService` resolver chain, custom editor capability registration and disposal. - `InstallEditorOperations.ts`: Decoration set-ranges, text edits (`editor.edit()`), active editor / selection state push to Mountain, and `revealRange` scrolling. - `InstallTreeView.ts`: Tree view data provider attach (`TreeViewByViewId`), `ProvideChildren` via `MountainIPCInvoke`, exponential backoff retry chain, pending-attach queue for late-registering extensions, and DOM `cel:tree-view:*` event listeners. - `InstallUiRequests.ts`: Four show-message / show-input-box / show-quick-pick / show-message-with-actions request channels that require `ResolveUIRequest` round-trips to Mountain. Each module receives only the dependencies it needs (`Register`, `GetServices`, `Invoke`, `ApplyHtmlToWebview`, `ShowNotification`, `ResolveUiRequest`) via a thin injector interface, eliminating global-scope closure capture across unrelated handlers. The decomposition also simplifies per-module type definitions — previously all handler types were implicitly Any-typed from the inline closure chain. Minor side-effects: - `InstallDiagnostics.ts` and `InstallSearch.ts` get light formatting cleanup (single-line collapsed type annotations, removal of unused `Register` parameter) without behavioral change. - `ApplyHtmlToWebview` now loads eagerly in the bridge lifecycle (before any import call) so it's available for InstallWebview's registration callback, with a `globalThis.__CEL_WEBVIEW_APPLY_HTML__` stash for late-bound workbench resolvers. The bridge's observable behaviour is unchanged: every registered channel fires the same handler logic as before, just from a dedicated module source file.
1 parent c6982bf commit 47d08be

7 files changed

Lines changed: 1639 additions & 2559 deletions

File tree

0 commit comments

Comments
 (0)