Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/Model/
ModelGetAll.rs

1//! Bulk snapshot of every open text model. Used by Wind on
2//! workbench restore to repopulate the Monaco model registry
3//! without per-tab `ModelOpen` round-trips.
4
5use std::sync::Arc;
6
7use serde_json::{Value, json};
8
9use crate::RunTime::ApplicationRunTime::ApplicationRunTime;
10
11pub async fn Fn(RunTime:Arc<ApplicationRunTime>) -> Result<Value, String> {
12	let All = RunTime
13		.Environment
14		.ApplicationState
15		.Feature
16		.Documents
17		.GetAll()
18		.into_iter()
19		.map(|(Uri, Document)| {
20			json!({
21				"uri": Uri,
22				"content": Document.Lines.join(&Document.EOL),
23				"version": Document.Version,
24				"languageId": Document.LanguageIdentifier,
25			})
26		})
27		.collect::<Vec<_>>();
28
29	Ok(Value::Array(All))
30}