Common/Output/
OutputChannelManager.rs

1//! # OutputChannelManager Trait
2//!
3//! Defines the abstract service trait for managing output channels.
4
5use async_trait::async_trait;
6
7use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
8
9/// An abstract service contract for an environment component that can manage
10/// output channels.
11///
12/// Output channels are a common feature in IDEs, used for displaying logs,
13
14/// build outputs, or other textual information from extensions or system
15/// processes.
16#[async_trait]
17pub trait OutputChannelManager: Environment + Send + Sync {
18	/// Registers a new output channel with the host.
19	///
20	/// # Parameters
21	/// * `Name`: The human-readable name of the channel to be displayed in the
22	///   UI.
23	/// * `LanguageIdentifier`: An optional language ID to enable syntax
24	///   highlighting for the channel's content.
25	///
26	/// # Returns
27	/// A `Result` containing a unique identifier (string) for the new channel.
28	async fn RegisterChannel(&self, Name:String, LanguageIdentifier:Option<String>) -> Result<String, CommonError>;
29
30	/// Appends a string value to the specified output channel.
31	///
32	/// # Parameters
33	/// * `ChannelIdentifier`: The unique ID of the target channel.
34	/// * `Value`: The string content to append.
35	async fn Append(&self, ChannelIdentifier:String, Value:String) -> Result<(), CommonError>;
36
37	/// Replaces the entire content of the specified output channel with a new
38	/// value.
39	///
40	/// # Parameters
41	/// * `ChannelIdentifier`: The unique ID of the target channel.
42	/// * `Value`: The new string content for the channel.
43	async fn Replace(&self, ChannelIdentifier:String, Value:String) -> Result<(), CommonError>;
44
45	/// Clears all content from the specified output channel.
46	async fn Clear(&self, ChannelIdentifier:String) -> Result<(), CommonError>;
47
48	/// Reveals (opens and focuses) the specified output channel in the UI.
49	///
50	/// # Parameters
51	/// * `ChannelIdentifier`: The ID of the channel to reveal.
52	/// * `PreserveFocus`: If `true`, the focus will remain in its current
53	///   location instead of moving to the output channel.
54	async fn Reveal(&self, ChannelIdentifier:String, PreserveFocus:bool) -> Result<(), CommonError>;
55
56	/// Closes the view of the specified output channel in the UI, but does not
57	/// dispose of it. The channel can be revealed again later.
58	async fn Close(&self, ChannelIdentifier:String) -> Result<(), CommonError>;
59
60	/// Disposes of the specified output channel, removing it and its content
61	/// permanently.
62	async fn Dispose(&self, ChannelIdentifier:String) -> Result<(), CommonError>;
63}