Workflow
Invoking a Language Feature (Hover Provider)
Bi-directional communication: extension registers a feature, Mountain orchestrates the request, result displayed in Wind UI.
Invoking a Language Feature (Hover Provider)
A key example of bi-directional communication: an extension in Cocoon registers a hover provider, Mountain orchestrates the request, and the result is displayed in the Wind UI.
Data Flow
Phase 1: Registration
Extension calls vscode.languages.registerHoverProvider('mylang', provider)
-> Cocoon stores provider with unique handle (e.g. 123)
-> Cocoon sends $registerHoverProvider gRPC to Mountain
-> Mountain creates ProviderRegistrationDto
-> Mountain stores in AppState.LanguageProviders
Phase 2: User Hover Request
User hovers over a word in a "mylang" file
-> Monaco hover controller triggers
-> LanguageFeaturesService.getHover()
-> TauriInvoke('mountain://language-feature/provide-hover')
Phase 3: Host Orchestration
-> Mountain queries AppState.LanguageProviders for "mylang" hover providers
-> Finds registration (handle 123) belonging to cocoon-main
-> Mountain sends $provideHover gRPC to Cocoon (handle, URI, position)
Phase 4: Extension Execution
-> Cocoon looks up provider by handle
-> Calls provider.provideHover(document, position, token)
-> Extension returns Hover object { contents: ['Hello World'] }
-> Cocoon serializes to HoverResultDto
-> Returns to Mountain
Phase 5: UI Update
-> Mountain returns hover data to Wind
-> Wind passes data to Monaco controller
-> Monaco renders tooltip widget
-> User sees "Hello World" tooltipPhase 1: Extension Registration (Cocoon)
- Extension is activated by Cocoon. Its
activate()function runs. - Extension calls
vscode.languages.registerHoverProvider('mylang', provider). LanguageFeaturesProviderin Cocoon stores the provider in a local map with a unique handle.- Sends
$registerHoverProvidergRPC request to Mountain with the handle and metadata.
Phase 2: Host-Side Provider Registration (Mountain)
- gRPC server receives
$registerHoverProviderand dispatches totrack. LanguageFeatureProvider.RegisterProvider()executes viaAppRuntime.Registration.register_provider()creates aProviderRegistrationDtoand stores it inAppState.LanguageProviders. Mountain now knows that for language “mylang”,cocoon-mainhas a hover provider with handle123.
Phase 3: User Interaction and UI Request (Wind/Sky)
- User hovers over a word in a “mylang” file. Monaco’s hover controller triggers.
ILanguageFeaturesService.getHover()creates an Effect that callsTauriInvoke('mountain://language-feature/provide-hover').
Phase 4: Host-Side Orchestration (Mountain -> Cocoon)
LanguageFeatureProvider.ProvideHover()queriesAppState.LanguageProvidersand finds handle123belonging tococoon-main.- Makes
$provideHovergRPC request to Cocoon with document URI, position, and provider handle.
Phase 5: Extension Execution and Response (Cocoon)
- Cocoon’s gRPC server dispatches to the handler, which looks up the provider by handle.
- Calls
provider.provideHover(document, position, token). Extension code executes. - Extension returns
Hoverobject. Handler serializes toHoverResultDtoand returns to Mountain.
Phase 6: Final UI Update (Mountain -> Wind/Sky)
- gRPC call resolves with
HoverResultDto. Result sent back as response to the original Tauri invoke. - Wind receives hover data, passes to Monaco’s hover controller.
- Monaco renders the tooltip widget on screen.
Key Source Files
Cocoon/src/Service/LanguageFeatures.ts— language feature providerMountain/Source/Environment/LanguageFeatureProvider/Registration.rs— provider registrationMountain/Source/Environment/LanguageFeatureProvider/FeatureMethods.rs— feature executionMountain/Source/track/TrackLogic.rs— track dispatcher
