Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/RPC/CocoonService/
mod.rs

1// # CocoonServiceImpl - thin-wrapper dispatcher
2//
3// Domain files hold all typed RPC implementations. This module keeps:
4// - CocoonServiceImpl struct + helper methods
5// - process_mountain_request (legacy generic router, ~600 lines)
6// - send_mountain_notification (push dispatcher, ~400 lines)
7// - One-line delegates for all 78 typed RPCs
8
9pub mod Auth;
10
11pub mod GenericNotification;
12
13pub mod GenericRequest;
14
15pub mod Command;
16
17pub mod Debug;
18
19pub mod Extension;
20
21pub mod FileSystem;
22
23pub mod Initialization;
24
25pub mod Output;
26
27pub mod Provider;
28
29pub mod Save;
30
31pub mod SCM;
32
33pub mod Secret;
34
35pub mod Task;
36
37pub mod Terminal;
38
39pub mod TreeView;
40
41pub mod Window;
42
43pub mod Workspace;
44
45use std::{
46	collections::HashMap,
47	sync::Arc,
48	time::{SystemTime, UNIX_EPOCH},
49};
50
51use async_trait::async_trait;
52use CommonLibrary::{
53	Command::CommandExecutor::CommandExecutor,
54	LanguageFeature::{
55		DTO::{PositionDTO::PositionDTO, ProviderType::ProviderType},
56		LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry,
57	},
58	Secret::SecretProvider::SecretProvider,
59	Terminal::TerminalProvider::TerminalProvider,
60	UserInterface::{
61		DTO::{
62			InputBoxOptionsDTO::InputBoxOptionsDTO,
63			QuickPickItemDTO::QuickPickItemDTO,
64			QuickPickOptionsDTO::QuickPickOptionsDTO,
65		},
66		UserInterfaceProvider::UserInterfaceProvider,
67	},
68};
69use serde_json::json;
70use tokio::sync::RwLock;
71use tonic::{Request, Response, Status};
72use url::Url;
73
74use crate::{
75	ApplicationState::DTO::{
76		ProviderRegistrationDTO::ProviderRegistrationDTO,
77		WorkspaceFolderStateDTO::WorkspaceFolderStateDTO,
78	},
79	Environment::MountainEnvironment::MountainEnvironment,
80};
81// Import generated protobuf types
82use crate::dev_log;
83use crate::Vine::Generated::{
84	// Service trait
85	// Extended Language + Window + FS + Output + Task + Auth + Debug + Extension types
86	AppendOutputRequest,
87	ApplyEditRequest,
88	ApplyEditResponse,
89	Argument,
90	CancelOperationRequest,
91
92	ClearOutputRequest,
93	CloseTerminalRequest,
94	CodeAction,
95
96	CompletionItem,
97	CopyFileRequest,
98	CreateDirectoryRequest,
99	CreateOutputChannelRequest,
100	CreateOutputChannelResponse,
101	CreateStatusBarItemRequest,
102	CreateStatusBarItemResponse,
103	CreateWebviewPanelRequest,
104	CreateWebviewPanelResponse,
105	DebugConfiguration,
106	DeleteFileRequest,
107	DeleteSecretRequest,
108	DisposeOutputRequest,
109	DisposeWebviewPanelRequest,
110	// Common types
111	Empty,
112	ExecuteCommandRequest,
113	ExecuteCommandResponse,
114	ExecuteTaskRequest,
115	ExecuteTaskResponse,
116	ExtensionInfo,
117	// Workspace Operations
118	FindFilesRequest,
119	FindFilesResponse,
120	FindTextInFilesRequest,
121	FindTextInFilesResponse,
122	GenericNotification as GenericNotificationMsg,
123	// Common generic types
124	GenericRequest as GenericRequestMsg,
125	GenericResponse,
126	GetAllExtensionsResponse,
127	GetAuthenticationSessionRequest,
128	GetAuthenticationSessionResponse,
129	GetConfigurationRequest,
130	GetConfigurationResponse,
131	GetExtensionRequest,
132	GetExtensionResponse,
133	// Secret Storage
134	GetSecretRequest,
135	GetSecretResponse,
136	GetTreeChildrenRequest,
137	GetTreeChildrenResponse,
138	GitExecRequest,
139	GitExecResponse,
140
141	// Initialization
142	InitExtensionHostRequest,
143
144	Location,
145	OnDidReceiveMessageRequest,
146
147	OpenDocumentRequest,
148	OpenDocumentResponse,
149	OpenExternalRequest,
150	// Terminal
151	OpenTerminalRequest,
152	// Save Participants
153	ParticipateInSaveRequest,
154	ParticipateInSaveResponse,
155	Position,
156	PostWebviewMessageRequest,
157	ProvideCallHierarchyRequest,
158	ProvideCallHierarchyResponse,
159	ProvideCodeActionsRequest,
160	ProvideCodeActionsResponse,
161	ProvideCodeLensesRequest,
162	ProvideCodeLensesResponse,
163	ProvideCompletionItemsRequest,
164	ProvideCompletionItemsResponse,
165	ProvideDefinitionRequest,
166	ProvideDefinitionResponse,
167	ProvideDocumentFormattingRequest,
168	ProvideDocumentFormattingResponse,
169	ProvideDocumentHighlightsRequest,
170	ProvideDocumentHighlightsResponse,
171	ProvideDocumentRangeFormattingRequest,
172	ProvideDocumentRangeFormattingResponse,
173	ProvideDocumentSymbolsRequest,
174	ProvideDocumentSymbolsResponse,
175	ProvideFoldingRangesRequest,
176	ProvideFoldingRangesResponse,
177	ProvideHoverRequest,
178	ProvideHoverResponse,
179	ProvideInlayHintsRequest,
180	ProvideInlayHintsResponse,
181	ProvideInlineCompletionRequest,
182	ProvideInlineCompletionResponse,
183	ProvideLinkedEditingRangesRequest,
184	ProvideLinkedEditingRangesResponse,
185	ProvideOnTypeFormattingRequest,
186	ProvideOnTypeFormattingResponse,
187	ProvideReferencesRequest,
188	ProvideReferencesResponse,
189	ProvideRenameEditsRequest,
190	ProvideRenameEditsResponse,
191	ProvideSelectionRangesRequest,
192	ProvideSelectionRangesResponse,
193	ProvideSemanticTokensRequest,
194	ProvideSemanticTokensResponse,
195	ProvideSignatureHelpRequest,
196	ProvideSignatureHelpResponse,
197	ProvideTypeHierarchyRequest,
198	ProvideTypeHierarchyResponse,
199	ProvideWorkspaceSymbolsRequest,
200	ProvideWorkspaceSymbolsResponse,
201	Range,
202	// File System
203	ReadFileRequest,
204	ReadFileResponse,
205	ReaddirRequest,
206	ReaddirResponse,
207	RegisterAuthenticationProviderRequest,
208	// Commands
209	RegisterCommandRequest,
210	// Debug
211	RegisterDebugAdapterRequest,
212	RegisterOnTypeFormattingProviderRequest,
213	// Language Features
214	RegisterProviderRequest,
215	// SCM
216	RegisterScmProviderRequest,
217	RegisterSemanticTokensProviderRequest,
218	RegisterSignatureHelpProviderRequest,
219	RegisterTaskProviderRequest,
220	// Tree View
221	RegisterTreeViewProviderRequest,
222	RenameFileRequest,
223	ReportProgressRequest,
224	ResizeTerminalRequest,
225	RpcError,
226	SaveAllRequest,
227	SaveAllResponse,
228	SetStatusBarTextRequest,
229	SetWebviewHtmlRequest,
230	ShowInputBoxRequest,
231	ShowInputBoxResponse,
232	ShowMessageRequest,
233	ShowMessageResponse,
234	ShowOutputRequest,
235	ShowProgressRequest,
236	ShowProgressResponse,
237	ShowQuickPickRequest,
238	ShowQuickPickResponse,
239	// Window Operations
240	ShowTextDocumentRequest,
241	ShowTextDocumentResponse,
242	SourceControlResourceState,
243	StartDebuggingRequest,
244	StartDebuggingResponse,
245
246	StatRequest,
247	StatResponse,
248	StopDebuggingRequest,
249	StoreSecretRequest,
250	TerminalClosedNotification,
251	TerminalDataNotification,
252
253	TerminalInputRequest,
254	TerminalOpenedNotification,
255	TerminalProcessIdNotification,
256	TerminateTaskRequest,
257	TextDocumentSaveReason,
258	TextEdit,
259	TextEditForSave,
260
261	TextMatch,
262	TreeItem,
263
264	UnregisterCommandRequest,
265
266	UpdateConfigurationRequest,
267	UpdateScmGroupRequest,
268	UpdateWorkspaceFoldersRequest,
269
270	Uri,
271	ViewColumn,
272
273	WatchFileRequest,
274
275	WorkspaceFolder,
276	WriteFileRequest,
277
278	cocoon_service_server::CocoonService,
279	on_did_receive_message_request,
280	post_webview_message_request,
281};
282
283/// Implementation of the CocoonService gRPC server
284///
285/// This struct handles all incoming requests from the Cocoon extension host
286/// sidecar and dispatches them to the appropriate Mountain services.
287#[derive(Clone)]
288pub struct CocoonServiceImpl {
289	/// Mountain environment providing access to all services
290	environment:Arc<MountainEnvironment>,
291
292	/// Registry of active operations with their cancellation tokens
293	/// Maps request ID to cancellation token for operation cancellation
294	ActiveOperations:Arc<RwLock<HashMap<u64, tokio_util::sync::CancellationToken>>>,
295}
296
297impl CocoonServiceImpl {
298	/// Creates a new instance of the CocoonService server
299	///
300	/// # Parameters
301	/// - `environment`: Mountain environment with access to all services
302	///
303	/// # Returns
304	/// A new CocoonService instance
305	pub fn new(environment:Arc<MountainEnvironment>) -> Self {
306		dev_log!("cocoon", "[CocoonService] New instance created");
307
308		Self { environment, ActiveOperations:Arc::new(RwLock::new(HashMap::new())) }
309	}
310
311	/// Registers an operation for potential cancellation
312	///
313	/// # Parameters
314	/// - `request_id`: The request identifier for the operation
315	///
316	/// # Returns
317	/// A cancellation token that can be used to cancel the operation
318	pub async fn RegisterOperation(&self, request_id:u64) -> tokio_util::sync::CancellationToken {
319		let token = tokio_util::sync::CancellationToken::new();
320
321		self.ActiveOperations.write().await.insert(request_id, token.clone());
322
323		dev_log!("cocoon", "[CocoonService] Registered operation {} for cancellation", request_id);
324
325		token
326	}
327
328	/// Unregisters an operation after completion
329	///
330	/// # Parameters
331	/// - `request_id`: The request identifier to unregister
332	pub async fn UnregisterOperation(&self, request_id:u64) {
333		self.ActiveOperations.write().await.remove(&request_id);
334
335		dev_log!("cocoon", "[CocoonService] Unregistered operation {}", request_id);
336	}
337
338	/// Registers a language feature provider in ApplicationState.
339	///
340	/// Converts the gRPC request fields into a `ProviderRegistrationDTO` and
341	/// stores it in `ApplicationState.Extension.ProviderRegistration`.
342	///
343	/// # Parameters
344	/// - `handle`: Unique provider handle
345	/// - `provider_type`: The type of language feature
346	/// - `language_selector`: Language scope (e.g. "typescript")
347	/// - `extension_id`: Extension that registered this provider
348	fn RegisterProvider(&self, handle:u32, provider_type:ProviderType, language_selector:&str, extension_id:&str) {
349		// SideCarIdentifier = "cocoon-main" so FeatureMethods::invoke_provider can
350		// route back via Vine::Client::SendRequestToSideCar("cocoon-main", ...).
351		// Selector stored as array so ProviderLookup::get_matching_provider's
352		// `.as_array()` call finds the language entry: [{ "language": "typescript" }].
353		let dto = ProviderRegistrationDTO {
354			Handle:handle,
355
356			ProviderType:provider_type,
357
358			Selector:json!([{ "language": language_selector }]),
359
360			SideCarIdentifier:"cocoon-main".to_string(),
361
362			ExtensionIdentifier:json!(extension_id),
363
364			Options:None,
365		};
366
367		self.environment
368			.ApplicationState
369			.Extension
370			.ProviderRegistration
371			.RegisterProvider(handle, dto);
372
373		dev_log!(
374			"cocoon",
375			"[CocoonService] Provider {:?} registered: handle={}, language={}",
376			provider_type,
377			handle,
378			language_selector
379		);
380	}
381
382	/// Extracts a filesystem path from a URI proto message.
383	///
384	/// Handles both `file://` URIs and bare paths. Returns `None` if the URI
385	/// is absent or the path cannot be extracted.
386	fn UriToPath(uri_opt:Option<&Uri>) -> Option<std::path::PathBuf> {
387		let value = uri_opt?.value.as_str();
388
389		if value.is_empty() {
390			return None;
391		}
392
393		// Strip file:// prefix if present
394		let path_str = if let Some(Stripped) = value.strip_prefix("file://") {
395			Stripped
396		} else if value.starts_with('/') || (value.len() > 1 && value.as_bytes()[1] == b':') {
397			// Bare absolute path (Unix or Windows)
398			value
399		} else {
400			// Unknown scheme - return as-is
401			value
402		};
403
404		Some(std::path::PathBuf::from(path_str))
405	}
406}
407
408#[async_trait]
409
410impl CocoonService for CocoonServiceImpl {
411	// LAND-PATCH B7-S6 P2: bidirectional streaming channel mirror.
412	// Stub matching MountainService::open_channel_from_cocoon. The
413	// multiplexer wiring lands with Patch 14; until then this
414	// returns `Unimplemented` and callers fall back to the unary
415	// methods.
416	type OpenChannelFromMountainStream = std::pin::Pin<
417		Box<
418			dyn tonic::codegen::tokio_stream::Stream<Item = Result<crate::Vine::Generated::Envelope, tonic::Status>>
419				+ Send
420				+ 'static,
421		>,
422	>;
423
424	async fn open_channel_from_mountain(
425		&self,
426
427		_request:tonic::Request<tonic::Streaming<crate::Vine::Generated::Envelope>>,
428	) -> Result<tonic::Response<Self::OpenChannelFromMountainStream>, tonic::Status> {
429		Err(tonic::Status::unimplemented(
430			"OpenChannelFromMountain: streaming multiplexer not yet wired (Patch 14); use unary endpoints",
431		))
432	}
433
434	/// Process Mountain requests from Cocoon (generic request-response).
435	/// Implementation in `GenericRequest::Dispatcher`.
436	async fn process_mountain_request(
437		&self,
438
439		request:Request<GenericRequestMsg>,
440	) -> Result<Response<GenericResponse>, Status> {
441		return GenericRequest::Dispatcher::Fn(self, request).await;
442	}
443
444	/// Send Mountain notifications to Cocoon (generic fire-and-forget).
445	/// Implementation in `GenericNotification::Dispatcher`.
446	async fn send_mountain_notification(
447		&self,
448
449		request:Request<GenericNotificationMsg>,
450	) -> Result<Response<Empty>, Status> {
451		return GenericNotification::Dispatcher::Fn(self, request).await;
452	}
453
454	async fn cancel_operation(&self, request:Request<CancelOperationRequest>) -> Result<Response<Empty>, Status> {
455		Initialization::CancelOperation::Fn(self, request.into_inner()).await
456	}
457
458	async fn initial_handshake(&self, request:Request<Empty>) -> Result<Response<Empty>, Status> {
459		Initialization::InitialHandshake::Fn(self, request.into_inner()).await
460	}
461
462	async fn init_extension_host(&self, request:Request<InitExtensionHostRequest>) -> Result<Response<Empty>, Status> {
463		Initialization::InitExtensionHost::Fn(self, request.into_inner()).await
464	}
465
466	async fn register_command(&self, request:Request<RegisterCommandRequest>) -> Result<Response<Empty>, Status> {
467		Command::RegisterCommand::Fn(self, request.into_inner()).await
468	}
469
470	async fn execute_contributed_command(
471		&self,
472
473		request:Request<ExecuteCommandRequest>,
474	) -> Result<Response<ExecuteCommandResponse>, Status> {
475		Command::ExecuteContributedCommand::Fn(self, request.into_inner()).await
476	}
477
478	async fn unregister_command(&self, request:Request<UnregisterCommandRequest>) -> Result<Response<Empty>, Status> {
479		Command::UnregisterCommand::Fn(self, request.into_inner()).await
480	}
481
482	async fn register_hover_provider(
483		&self,
484
485		request:Request<RegisterProviderRequest>,
486	) -> Result<Response<Empty>, Status> {
487		Provider::RegisterHoverProvider::Fn(self, request.into_inner()).await
488	}
489
490	async fn provide_hover(
491		&self,
492
493		request:Request<ProvideHoverRequest>,
494	) -> Result<Response<ProvideHoverResponse>, Status> {
495		Provider::ProvideHover::Fn(self, request.into_inner()).await
496	}
497
498	async fn register_completion_item_provider(
499		&self,
500
501		request:Request<RegisterProviderRequest>,
502	) -> Result<Response<Empty>, Status> {
503		Provider::RegisterCompletionItemProvider::Fn(self, request.into_inner()).await
504	}
505
506	async fn provide_completion_items(
507		&self,
508
509		request:Request<ProvideCompletionItemsRequest>,
510	) -> Result<Response<ProvideCompletionItemsResponse>, Status> {
511		Provider::ProvideCompletionItems::Fn(self, request.into_inner()).await
512	}
513
514	async fn register_definition_provider(
515		&self,
516
517		request:Request<RegisterProviderRequest>,
518	) -> Result<Response<Empty>, Status> {
519		Provider::RegisterDefinitionProvider::Fn(self, request.into_inner()).await
520	}
521
522	async fn provide_definition(
523		&self,
524
525		request:Request<ProvideDefinitionRequest>,
526	) -> Result<Response<ProvideDefinitionResponse>, Status> {
527		Provider::ProvideDefinition::Fn(self, request.into_inner()).await
528	}
529
530	async fn register_reference_provider(
531		&self,
532
533		request:Request<RegisterProviderRequest>,
534	) -> Result<Response<Empty>, Status> {
535		Provider::RegisterReferenceProvider::Fn(self, request.into_inner()).await
536	}
537
538	async fn provide_references(
539		&self,
540
541		request:Request<ProvideReferencesRequest>,
542	) -> Result<Response<ProvideReferencesResponse>, Status> {
543		Provider::ProvideReferences::Fn(self, request.into_inner()).await
544	}
545
546	async fn register_code_actions_provider(
547		&self,
548
549		request:Request<RegisterProviderRequest>,
550	) -> Result<Response<Empty>, Status> {
551		Provider::RegisterCodeActionsProvider::Fn(self, request.into_inner()).await
552	}
553
554	async fn provide_code_actions(
555		&self,
556
557		request:Request<ProvideCodeActionsRequest>,
558	) -> Result<Response<ProvideCodeActionsResponse>, Status> {
559		Provider::ProvideCodeActions::Fn(self, request.into_inner()).await
560	}
561
562	async fn show_text_document(
563		&self,
564
565		request:Request<ShowTextDocumentRequest>,
566	) -> Result<Response<ShowTextDocumentResponse>, Status> {
567		Window::ShowTextDocument::Fn(self, request.into_inner()).await
568	}
569
570	async fn show_information_message(
571		&self,
572
573		request:Request<ShowMessageRequest>,
574	) -> Result<Response<ShowMessageResponse>, Status> {
575		Window::ShowInformationMessage::Fn(self, request.into_inner()).await
576	}
577
578	async fn show_warning_message(
579		&self,
580
581		request:Request<ShowMessageRequest>,
582	) -> Result<Response<ShowMessageResponse>, Status> {
583		Window::ShowWarningMessage::Fn(self, request.into_inner()).await
584	}
585
586	async fn show_error_message(
587		&self,
588
589		request:Request<ShowMessageRequest>,
590	) -> Result<Response<ShowMessageResponse>, Status> {
591		Window::ShowErrorMessage::Fn(self, request.into_inner()).await
592	}
593
594	async fn create_status_bar_item(
595		&self,
596
597		request:Request<CreateStatusBarItemRequest>,
598	) -> Result<Response<CreateStatusBarItemResponse>, Status> {
599		Window::CreateStatusBarItem::Fn(self, request.into_inner()).await
600	}
601
602	async fn set_status_bar_text(&self, request:Request<SetStatusBarTextRequest>) -> Result<Response<Empty>, Status> {
603		Window::SetStatusBarText::Fn(self, request.into_inner()).await
604	}
605
606	async fn create_webview_panel(
607		&self,
608
609		request:Request<CreateWebviewPanelRequest>,
610	) -> Result<Response<CreateWebviewPanelResponse>, Status> {
611		Window::CreateWebviewPanel::Fn(self, request.into_inner()).await
612	}
613
614	async fn set_webview_html(&self, request:Request<SetWebviewHtmlRequest>) -> Result<Response<Empty>, Status> {
615		Window::SetWebviewHtml::Fn(self, request.into_inner()).await
616	}
617
618	async fn on_did_receive_message(
619		&self,
620
621		request:Request<OnDidReceiveMessageRequest>,
622	) -> Result<Response<Empty>, Status> {
623		Window::OnDidReceiveMessage::Fn(self, request.into_inner()).await
624	}
625
626	async fn post_webview_message(
627		&self,
628
629		request:Request<PostWebviewMessageRequest>,
630	) -> Result<Response<Empty>, Status> {
631		Window::PostWebviewMessage::Fn(self, request.into_inner()).await
632	}
633
634	async fn dispose_webview_panel(
635		&self,
636
637		request:Request<DisposeWebviewPanelRequest>,
638	) -> Result<Response<Empty>, Status> {
639		Window::DisposeWebviewPanel::Fn(self, request.into_inner()).await
640	}
641
642	async fn read_file(&self, request:Request<ReadFileRequest>) -> Result<Response<ReadFileResponse>, Status> {
643		FileSystem::ReadFile::Fn(self, request.into_inner()).await
644	}
645
646	async fn write_file(&self, request:Request<WriteFileRequest>) -> Result<Response<Empty>, Status> {
647		FileSystem::WriteFile::Fn(self, request.into_inner()).await
648	}
649
650	async fn stat(&self, request:Request<StatRequest>) -> Result<Response<StatResponse>, Status> {
651		FileSystem::Stat::Fn(self, request.into_inner()).await
652	}
653
654	async fn readdir(&self, request:Request<ReaddirRequest>) -> Result<Response<ReaddirResponse>, Status> {
655		FileSystem::Readdir::Fn(self, request.into_inner()).await
656	}
657
658	async fn watch_file(&self, request:Request<WatchFileRequest>) -> Result<Response<Empty>, Status> {
659		FileSystem::WatchFile::Fn(self, request.into_inner()).await
660	}
661
662	async fn find_files(&self, request:Request<FindFilesRequest>) -> Result<Response<FindFilesResponse>, Status> {
663		FileSystem::FindFiles::Fn(self, request.into_inner()).await
664	}
665
666	async fn find_text_in_files(
667		&self,
668
669		request:Request<FindTextInFilesRequest>,
670	) -> Result<Response<FindTextInFilesResponse>, Status> {
671		FileSystem::FindTextInFiles::Fn(self, request.into_inner()).await
672	}
673
674	async fn delete_file(&self, request:Request<DeleteFileRequest>) -> Result<Response<Empty>, Status> {
675		FileSystem::DeleteFile::Fn(self, request.into_inner()).await
676	}
677
678	async fn rename_file(&self, request:Request<RenameFileRequest>) -> Result<Response<Empty>, Status> {
679		FileSystem::RenameFile::Fn(self, request.into_inner()).await
680	}
681
682	async fn copy_file(&self, request:Request<CopyFileRequest>) -> Result<Response<Empty>, Status> {
683		FileSystem::CopyFile::Fn(self, request.into_inner()).await
684	}
685
686	async fn create_directory(&self, request:Request<CreateDirectoryRequest>) -> Result<Response<Empty>, Status> {
687		FileSystem::CreateDirectory::Fn(self, request.into_inner()).await
688	}
689
690	async fn open_document(
691		&self,
692
693		request:Request<OpenDocumentRequest>,
694	) -> Result<Response<OpenDocumentResponse>, Status> {
695		Workspace::OpenDocument::Fn(self, request.into_inner()).await
696	}
697
698	async fn save_all(&self, request:Request<SaveAllRequest>) -> Result<Response<SaveAllResponse>, Status> {
699		Workspace::SaveAll::Fn(self, request.into_inner()).await
700	}
701
702	async fn apply_edit(&self, request:Request<ApplyEditRequest>) -> Result<Response<ApplyEditResponse>, Status> {
703		Workspace::ApplyEdit::Fn(self, request.into_inner()).await
704	}
705
706	async fn update_configuration(
707		&self,
708
709		request:Request<UpdateConfigurationRequest>,
710	) -> Result<Response<Empty>, Status> {
711		Workspace::UpdateConfiguration::Fn(self, request.into_inner()).await
712	}
713
714	async fn update_workspace_folders(
715		&self,
716
717		request:Request<UpdateWorkspaceFoldersRequest>,
718	) -> Result<Response<Empty>, Status> {
719		Workspace::UpdateWorkspaceFolders::Fn(self, request.into_inner()).await
720	}
721
722	async fn open_terminal(&self, request:Request<OpenTerminalRequest>) -> Result<Response<Empty>, Status> {
723		Terminal::OpenTerminal::Fn(self, request.into_inner()).await
724	}
725
726	async fn terminal_input(&self, request:Request<TerminalInputRequest>) -> Result<Response<Empty>, Status> {
727		Terminal::TerminalInput::Fn(self, request.into_inner()).await
728	}
729
730	async fn close_terminal(&self, request:Request<CloseTerminalRequest>) -> Result<Response<Empty>, Status> {
731		Terminal::CloseTerminal::Fn(self, request.into_inner()).await
732	}
733
734	async fn accept_terminal_opened(
735		&self,
736
737		request:Request<TerminalOpenedNotification>,
738	) -> Result<Response<Empty>, Status> {
739		Terminal::AcceptTerminalOpened::Fn(self, request.into_inner()).await
740	}
741
742	async fn accept_terminal_closed(
743		&self,
744
745		request:Request<TerminalClosedNotification>,
746	) -> Result<Response<Empty>, Status> {
747		Terminal::AcceptTerminalClosed::Fn(self, request.into_inner()).await
748	}
749
750	async fn accept_terminal_process_id(
751		&self,
752
753		request:Request<TerminalProcessIdNotification>,
754	) -> Result<Response<Empty>, Status> {
755		Terminal::AcceptTerminalProcessId::Fn(self, request.into_inner()).await
756	}
757
758	async fn accept_terminal_process_data(
759		&self,
760
761		request:Request<TerminalDataNotification>,
762	) -> Result<Response<Empty>, Status> {
763		Terminal::AcceptTerminalProcessData::Fn(self, request.into_inner()).await
764	}
765
766	async fn resize_terminal(&self, request:Request<ResizeTerminalRequest>) -> Result<Response<Empty>, Status> {
767		Terminal::ResizeTerminal::Fn(self, request.into_inner()).await
768	}
769
770	async fn register_tree_view_provider(
771		&self,
772
773		request:Request<RegisterTreeViewProviderRequest>,
774	) -> Result<Response<Empty>, Status> {
775		TreeView::RegisterTreeViewProvider::Fn(self, request.into_inner()).await
776	}
777
778	async fn get_tree_children(
779		&self,
780
781		request:Request<GetTreeChildrenRequest>,
782	) -> Result<Response<GetTreeChildrenResponse>, Status> {
783		TreeView::GetTreeChildren::Fn(self, request.into_inner()).await
784	}
785
786	async fn register_scm_provider(
787		&self,
788
789		request:Request<RegisterScmProviderRequest>,
790	) -> Result<Response<Empty>, Status> {
791		SCM::RegisterScmProvider::Fn(self, request.into_inner()).await
792	}
793
794	async fn update_scm_group(&self, request:Request<UpdateScmGroupRequest>) -> Result<Response<Empty>, Status> {
795		SCM::UpdateScmGroup::Fn(self, request.into_inner()).await
796	}
797
798	async fn git_exec(&self, request:Request<GitExecRequest>) -> Result<Response<GitExecResponse>, Status> {
799		SCM::GitExec::Fn(self, request.into_inner()).await
800	}
801
802	async fn register_debug_adapter(
803		&self,
804
805		request:Request<RegisterDebugAdapterRequest>,
806	) -> Result<Response<Empty>, Status> {
807		Debug::RegisterDebugAdapter::Fn(self, request.into_inner()).await
808	}
809
810	async fn start_debugging(
811		&self,
812
813		request:Request<StartDebuggingRequest>,
814	) -> Result<Response<StartDebuggingResponse>, Status> {
815		Debug::StartDebugging::Fn(self, request.into_inner()).await
816	}
817
818	async fn stop_debugging(&self, request:Request<StopDebuggingRequest>) -> Result<Response<Empty>, Status> {
819		Debug::StopDebugging::Fn(self, request.into_inner()).await
820	}
821
822	async fn participate_in_save(
823		&self,
824
825		request:Request<ParticipateInSaveRequest>,
826	) -> Result<Response<ParticipateInSaveResponse>, Status> {
827		Save::Fn(self, request.into_inner()).await
828	}
829
830	async fn get_secret(&self, request:Request<GetSecretRequest>) -> Result<Response<GetSecretResponse>, Status> {
831		Secret::GetSecret::Fn(self, request.into_inner()).await
832	}
833
834	async fn store_secret(&self, request:Request<StoreSecretRequest>) -> Result<Response<Empty>, Status> {
835		Secret::StoreSecret::Fn(self, request.into_inner()).await
836	}
837
838	async fn delete_secret(&self, request:Request<DeleteSecretRequest>) -> Result<Response<Empty>, Status> {
839		Secret::DeleteSecret::Fn(self, request.into_inner()).await
840	}
841
842	async fn register_document_highlight_provider(
843		&self,
844
845		request:Request<RegisterProviderRequest>,
846	) -> Result<Response<Empty>, Status> {
847		Provider::RegisterDocumentHighlightProvider::Fn(self, request.into_inner()).await
848	}
849
850	async fn provide_document_highlights(
851		&self,
852
853		request:Request<ProvideDocumentHighlightsRequest>,
854	) -> Result<Response<ProvideDocumentHighlightsResponse>, Status> {
855		Provider::ProvideDocumentHighlights::Fn(self, request.into_inner()).await
856	}
857
858	async fn register_document_symbol_provider(
859		&self,
860
861		request:Request<RegisterProviderRequest>,
862	) -> Result<Response<Empty>, Status> {
863		Provider::RegisterDocumentSymbolProvider::Fn(self, request.into_inner()).await
864	}
865
866	async fn provide_document_symbols(
867		&self,
868
869		request:Request<ProvideDocumentSymbolsRequest>,
870	) -> Result<Response<ProvideDocumentSymbolsResponse>, Status> {
871		Provider::ProvideDocumentSymbols::Fn(self, request.into_inner()).await
872	}
873
874	async fn register_workspace_symbol_provider(
875		&self,
876
877		request:Request<RegisterProviderRequest>,
878	) -> Result<Response<Empty>, Status> {
879		Provider::RegisterWorkspaceSymbolProvider::Fn(self, request.into_inner()).await
880	}
881
882	async fn provide_workspace_symbols(
883		&self,
884
885		request:Request<ProvideWorkspaceSymbolsRequest>,
886	) -> Result<Response<ProvideWorkspaceSymbolsResponse>, Status> {
887		Provider::ProvideWorkspaceSymbols::Fn(self, request.into_inner()).await
888	}
889
890	async fn register_rename_provider(
891		&self,
892
893		request:Request<RegisterProviderRequest>,
894	) -> Result<Response<Empty>, Status> {
895		Provider::RegisterRenameProvider::Fn(self, request.into_inner()).await
896	}
897
898	async fn provide_rename_edits(
899		&self,
900
901		request:Request<ProvideRenameEditsRequest>,
902	) -> Result<Response<ProvideRenameEditsResponse>, Status> {
903		Provider::ProvideRenameEdits::Fn(self, request.into_inner()).await
904	}
905
906	async fn register_document_formatting_provider(
907		&self,
908
909		request:Request<RegisterProviderRequest>,
910	) -> Result<Response<Empty>, Status> {
911		Provider::RegisterDocumentFormattingProvider::Fn(self, request.into_inner()).await
912	}
913
914	async fn provide_document_formatting(
915		&self,
916
917		request:Request<ProvideDocumentFormattingRequest>,
918	) -> Result<Response<ProvideDocumentFormattingResponse>, Status> {
919		Provider::ProvideDocumentFormatting::Fn(self, request.into_inner()).await
920	}
921
922	async fn register_document_range_formatting_provider(
923		&self,
924
925		request:Request<RegisterProviderRequest>,
926	) -> Result<Response<Empty>, Status> {
927		Provider::RegisterDocumentRangeFormattingProvider::Fn(self, request.into_inner()).await
928	}
929
930	async fn provide_document_range_formatting(
931		&self,
932
933		request:Request<ProvideDocumentRangeFormattingRequest>,
934	) -> Result<Response<ProvideDocumentRangeFormattingResponse>, Status> {
935		Provider::ProvideDocumentRangeFormatting::Fn(self, request.into_inner()).await
936	}
937
938	async fn register_on_type_formatting_provider(
939		&self,
940
941		request:Request<RegisterOnTypeFormattingProviderRequest>,
942	) -> Result<Response<Empty>, Status> {
943		Provider::RegisterOnTypeFormattingProvider::Fn(self, request.into_inner()).await
944	}
945
946	async fn provide_on_type_formatting(
947		&self,
948
949		request:Request<ProvideOnTypeFormattingRequest>,
950	) -> Result<Response<ProvideOnTypeFormattingResponse>, Status> {
951		Provider::ProvideOnTypeFormatting::Fn(self, request.into_inner()).await
952	}
953
954	async fn register_signature_help_provider(
955		&self,
956
957		request:Request<RegisterSignatureHelpProviderRequest>,
958	) -> Result<Response<Empty>, Status> {
959		Provider::RegisterSignatureHelpProvider::Fn(self, request.into_inner()).await
960	}
961
962	async fn provide_signature_help(
963		&self,
964
965		request:Request<ProvideSignatureHelpRequest>,
966	) -> Result<Response<ProvideSignatureHelpResponse>, Status> {
967		Provider::ProvideSignatureHelp::Fn(self, request.into_inner()).await
968	}
969
970	async fn register_code_lens_provider(
971		&self,
972
973		request:Request<RegisterProviderRequest>,
974	) -> Result<Response<Empty>, Status> {
975		Provider::RegisterCodeLensProvider::Fn(self, request.into_inner()).await
976	}
977
978	async fn provide_code_lenses(
979		&self,
980
981		request:Request<ProvideCodeLensesRequest>,
982	) -> Result<Response<ProvideCodeLensesResponse>, Status> {
983		Provider::ProvideCodeLenses::Fn(self, request.into_inner()).await
984	}
985
986	async fn register_folding_range_provider(
987		&self,
988
989		request:Request<RegisterProviderRequest>,
990	) -> Result<Response<Empty>, Status> {
991		Provider::RegisterFoldingRangeProvider::Fn(self, request.into_inner()).await
992	}
993
994	async fn provide_folding_ranges(
995		&self,
996
997		request:Request<ProvideFoldingRangesRequest>,
998	) -> Result<Response<ProvideFoldingRangesResponse>, Status> {
999		Provider::ProvideFoldingRanges::Fn(self, request.into_inner()).await
1000	}
1001
1002	async fn register_selection_range_provider(
1003		&self,
1004
1005		request:Request<RegisterProviderRequest>,
1006	) -> Result<Response<Empty>, Status> {
1007		Provider::RegisterSelectionRangeProvider::Fn(self, request.into_inner()).await
1008	}
1009
1010	async fn provide_selection_ranges(
1011		&self,
1012
1013		request:Request<ProvideSelectionRangesRequest>,
1014	) -> Result<Response<ProvideSelectionRangesResponse>, Status> {
1015		Provider::ProvideSelectionRanges::Fn(self, request.into_inner()).await
1016	}
1017
1018	async fn register_semantic_tokens_provider(
1019		&self,
1020
1021		request:Request<RegisterSemanticTokensProviderRequest>,
1022	) -> Result<Response<Empty>, Status> {
1023		Provider::RegisterSemanticTokensProvider::Fn(self, request.into_inner()).await
1024	}
1025
1026	async fn provide_semantic_tokens_full(
1027		&self,
1028
1029		request:Request<ProvideSemanticTokensRequest>,
1030	) -> Result<Response<ProvideSemanticTokensResponse>, Status> {
1031		Provider::ProvideSemanticTokensFull::Fn(self, request.into_inner()).await
1032	}
1033
1034	async fn register_inlay_hints_provider(
1035		&self,
1036
1037		request:Request<RegisterProviderRequest>,
1038	) -> Result<Response<Empty>, Status> {
1039		Provider::RegisterInlayHintsProvider::Fn(self, request.into_inner()).await
1040	}
1041
1042	async fn provide_inlay_hints(
1043		&self,
1044
1045		request:Request<ProvideInlayHintsRequest>,
1046	) -> Result<Response<ProvideInlayHintsResponse>, Status> {
1047		Provider::ProvideInlayHints::Fn(self, request.into_inner()).await
1048	}
1049
1050	async fn register_type_hierarchy_provider(
1051		&self,
1052
1053		request:Request<RegisterProviderRequest>,
1054	) -> Result<Response<Empty>, Status> {
1055		Provider::RegisterTypeHierarchyProvider::Fn(self, request.into_inner()).await
1056	}
1057
1058	async fn provide_type_hierarchy_supertypes(
1059		&self,
1060
1061		request:Request<ProvideTypeHierarchyRequest>,
1062	) -> Result<Response<ProvideTypeHierarchyResponse>, Status> {
1063		Provider::ProvideTypeHierarchySupertypes::Fn(self, request.into_inner()).await
1064	}
1065
1066	async fn provide_type_hierarchy_subtypes(
1067		&self,
1068
1069		request:Request<ProvideTypeHierarchyRequest>,
1070	) -> Result<Response<ProvideTypeHierarchyResponse>, Status> {
1071		Provider::ProvideTypeHierarchySubtypes::Fn(self, request.into_inner()).await
1072	}
1073
1074	async fn register_call_hierarchy_provider(
1075		&self,
1076
1077		request:Request<RegisterProviderRequest>,
1078	) -> Result<Response<Empty>, Status> {
1079		Provider::RegisterCallHierarchyProvider::Fn(self, request.into_inner()).await
1080	}
1081
1082	async fn provide_call_hierarchy_incoming_calls(
1083		&self,
1084
1085		request:Request<ProvideCallHierarchyRequest>,
1086	) -> Result<Response<ProvideCallHierarchyResponse>, Status> {
1087		Provider::ProvideCallHierarchyIncomingCalls::Fn(self, request.into_inner()).await
1088	}
1089
1090	async fn provide_call_hierarchy_outgoing_calls(
1091		&self,
1092
1093		request:Request<ProvideCallHierarchyRequest>,
1094	) -> Result<Response<ProvideCallHierarchyResponse>, Status> {
1095		Provider::ProvideCallHierarchyOutgoingCalls::Fn(self, request.into_inner()).await
1096	}
1097
1098	async fn register_linked_editing_range_provider(
1099		&self,
1100
1101		request:Request<RegisterProviderRequest>,
1102	) -> Result<Response<Empty>, Status> {
1103		Provider::RegisterLinkedEditingRangeProvider::Fn(self, request.into_inner()).await
1104	}
1105
1106	async fn provide_linked_editing_ranges(
1107		&self,
1108
1109		request:Request<ProvideLinkedEditingRangesRequest>,
1110	) -> Result<Response<ProvideLinkedEditingRangesResponse>, Status> {
1111		Provider::ProvideLinkedEditingRanges::Fn(self, request.into_inner()).await
1112	}
1113
1114	async fn register_inline_completion_item_provider(
1115		&self,
1116
1117		request:Request<RegisterProviderRequest>,
1118	) -> Result<Response<Empty>, Status> {
1119		// Registration: store handle + selector in the LanguageFeatureProviderRegistry.
1120		// The generic NotificationDispatcher already handles
1121		// `register_inline_completion_item_provider` coming via
1122		// SendCocoonNotification; this typed path is the proto-generated entry point.
1123		// NOTE: prost generates snake_case fields from the proto definition.
1124		let Inner = request.into_inner();
1125
1126		let Handle = Inner.handle;
1127
1128		let Selector = Inner.language_selector.clone();
1129
1130		let ExtId = Inner.extension_id.clone();
1131
1132		self.RegisterProvider(Handle, ProviderType::InlineCompletion, &Selector, &ExtId);
1133
1134		Ok(Response::new(Empty {}))
1135	}
1136
1137	async fn provide_inline_completion_items(
1138		&self,
1139
1140		request:Request<ProvideInlineCompletionRequest>,
1141	) -> Result<Response<ProvideInlineCompletionResponse>, Status> {
1142		Provider::ProvideInlineCompletionItems::Fn(self, request.into_inner()).await
1143	}
1144
1145	async fn show_quick_pick(
1146		&self,
1147
1148		request:Request<ShowQuickPickRequest>,
1149	) -> Result<Response<ShowQuickPickResponse>, Status> {
1150		Window::ShowQuickPick::Fn(self, request.into_inner()).await
1151	}
1152
1153	async fn show_input_box(
1154		&self,
1155
1156		request:Request<ShowInputBoxRequest>,
1157	) -> Result<Response<ShowInputBoxResponse>, Status> {
1158		Window::ShowInputBox::Fn(self, request.into_inner()).await
1159	}
1160
1161	async fn show_progress(
1162		&self,
1163
1164		request:Request<ShowProgressRequest>,
1165	) -> Result<Response<ShowProgressResponse>, Status> {
1166		Window::ShowProgress::Fn(self, request.into_inner()).await
1167	}
1168
1169	async fn report_progress(&self, request:Request<ReportProgressRequest>) -> Result<Response<Empty>, Status> {
1170		Window::ReportProgress::Fn(self, request.into_inner()).await
1171	}
1172
1173	async fn open_external(&self, request:Request<OpenExternalRequest>) -> Result<Response<Empty>, Status> {
1174		Window::OpenExternal::Fn(self, request.into_inner()).await
1175	}
1176
1177	async fn create_output_channel(
1178		&self,
1179
1180		request:Request<CreateOutputChannelRequest>,
1181	) -> Result<Response<CreateOutputChannelResponse>, Status> {
1182		Output::CreateOutputChannel::Fn(self, request.into_inner()).await
1183	}
1184
1185	async fn append_output(&self, request:Request<AppendOutputRequest>) -> Result<Response<Empty>, Status> {
1186		Output::AppendOutput::Fn(self, request.into_inner()).await
1187	}
1188
1189	async fn clear_output(&self, request:Request<ClearOutputRequest>) -> Result<Response<Empty>, Status> {
1190		Output::ClearOutput::Fn(self, request.into_inner()).await
1191	}
1192
1193	async fn show_output(&self, request:Request<ShowOutputRequest>) -> Result<Response<Empty>, Status> {
1194		Output::ShowOutput::Fn(self, request.into_inner()).await
1195	}
1196
1197	async fn dispose_output(&self, request:Request<DisposeOutputRequest>) -> Result<Response<Empty>, Status> {
1198		Output::DisposeOutput::Fn(self, request.into_inner()).await
1199	}
1200
1201	async fn register_task_provider(
1202		&self,
1203
1204		request:Request<RegisterTaskProviderRequest>,
1205	) -> Result<Response<Empty>, Status> {
1206		Task::RegisterTaskProvider::Fn(self, request.into_inner()).await
1207	}
1208
1209	async fn execute_task(&self, request:Request<ExecuteTaskRequest>) -> Result<Response<ExecuteTaskResponse>, Status> {
1210		Task::ExecuteTask::Fn(self, request.into_inner()).await
1211	}
1212
1213	async fn terminate_task(&self, request:Request<TerminateTaskRequest>) -> Result<Response<Empty>, Status> {
1214		Task::TerminateTask::Fn(self, request.into_inner()).await
1215	}
1216
1217	async fn get_authentication_session(
1218		&self,
1219
1220		request:Request<GetAuthenticationSessionRequest>,
1221	) -> Result<Response<GetAuthenticationSessionResponse>, Status> {
1222		Auth::GetAuthenticationSession::Fn(self, request.into_inner()).await
1223	}
1224
1225	async fn register_authentication_provider(
1226		&self,
1227
1228		request:Request<RegisterAuthenticationProviderRequest>,
1229	) -> Result<Response<Empty>, Status> {
1230		Auth::RegisterAuthenticationProvider::Fn(self, request.into_inner()).await
1231	}
1232
1233	async fn get_extension(
1234		&self,
1235
1236		request:Request<GetExtensionRequest>,
1237	) -> Result<Response<GetExtensionResponse>, Status> {
1238		Extension::GetExtension::Fn(self, request.into_inner()).await
1239	}
1240
1241	async fn get_all_extensions(&self, request:Request<Empty>) -> Result<Response<GetAllExtensionsResponse>, Status> {
1242		Extension::GetAllExtensions::Fn(self, request.into_inner()).await
1243	}
1244
1245	async fn get_configuration(
1246		&self,
1247
1248		request:Request<GetConfigurationRequest>,
1249	) -> Result<Response<GetConfigurationResponse>, Status> {
1250		Extension::GetConfiguration::Fn(self, request.into_inner()).await
1251	}
1252}