diff options
Diffstat (limited to 'cli/config_file.rs')
-rw-r--r-- | cli/config_file.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/config_file.rs b/cli/config_file.rs index 156350064..2c1ec7907 100644 --- a/cli/config_file.rs +++ b/cli/config_file.rs @@ -649,6 +649,25 @@ impl ConfigFile { } } + /// Return any tasks that are defined in the configuration file as a sequence + /// of JSON objects providing the name of the task and the arguments of the + /// task in a detail field. + pub fn to_lsp_tasks(&self) -> Option<Value> { + let value = self.json.tasks.clone()?; + let tasks: BTreeMap<String, String> = serde_json::from_value(value).ok()?; + Some( + tasks + .into_iter() + .map(|(key, value)| { + json!({ + "name": key, + "detail": value, + }) + }) + .collect(), + ) + } + pub fn to_tasks_config( &self, ) -> Result<Option<BTreeMap<String, String>>, AnyError> { |