forked from 1b-agent/opencadstudio-upstream
Add versioned host settings API for plugins
This commit is contained in:
1 parent
93afe91afc
commit
ec2271fc9c
13 files changed
+218
-17
No files matched your search
@@ -60,6 +60,13 @@ pub enum LogLevel {
|
||||
Error,
|
||||
}
|
||||
|
||||
/// Value of a host-managed drafting or document setting exposed to plugins.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub enum HostSettingValue {
|
||||
Text(String),
|
||||
Number(f64),
|
||||
}
|
||||
|
||||
/// A notification the host sends to a plugin. These are best-effort,
|
||||
/// full-duplex messages correlated with an optional `command_id`.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
@@ -552,6 +559,22 @@ pub trait HostApi {
|
||||
let _ = tab_id;
|
||||
None
|
||||
}
|
||||
|
||||
/// Read a named host setting without invoking the command dispatcher.
|
||||
/// Names are case-insensitive. Hosts may support only a subset.
|
||||
fn system_variable(&self, _name: &str) -> Option<HostSettingValue> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Set a named host setting without re-entering command dispatch.
|
||||
/// Returns the effective value after validation and normalization.
|
||||
fn set_system_variable(
|
||||
&mut self,
|
||||
_name: &str,
|
||||
_value: HostSettingValue,
|
||||
) -> Result<HostSettingValue, String> {
|
||||
Err("system variable is not supported by this host".to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
/// Simplified, read-only entity kind exposed by [`DocumentReader`].
|
||||
|
||||
Reference in new issue
Block a user