mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 17:58:17 +00:00
feat: support root path configuration
This commit is contained in:
parent
1c825607b2
commit
f11f4a462f
2 changed files with 24 additions and 23 deletions
|
@ -23,7 +23,8 @@ impl TypstLanguageServer {
|
|||
let (render_tx, _) = broadcast::channel(10);
|
||||
|
||||
let roots = self.roots.clone();
|
||||
let root_dir = roots.first().cloned().unwrap_or_default();
|
||||
let root_dir = self.config.root_path.clone();
|
||||
let root_dir = root_dir.unwrap_or_else(|| roots.first().cloned().unwrap_or_default());
|
||||
// Run the PDF export actor before preparing cluster to avoid loss of events
|
||||
tokio::spawn(
|
||||
PdfExportActor::new(
|
||||
|
|
|
@ -804,33 +804,33 @@ impl TypstLanguageServer {
|
|||
let output_directory = self.config.output_path.clone();
|
||||
let export_pdf = self.config.export_pdf;
|
||||
match self.config.update_by_map(&values) {
|
||||
Ok(()) => {
|
||||
info!("new settings applied");
|
||||
|
||||
if output_directory != self.config.output_path
|
||||
|| export_pdf != self.config.export_pdf
|
||||
{
|
||||
let config = PdfExportConfig {
|
||||
substitute_pattern: self.config.output_path.clone(),
|
||||
mode: self.config.export_pdf,
|
||||
root: Path::new("").into(),
|
||||
path: None,
|
||||
};
|
||||
|
||||
self.primary().change_export_pdf(config.clone());
|
||||
{
|
||||
let m = self.main.lock();
|
||||
if let Some(main) = m.as_ref() {
|
||||
main.wait().change_export_pdf(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(()) => {}
|
||||
Err(err) => {
|
||||
error!("error applying new settings: {err}");
|
||||
return Err(internal_error("Internal error"));
|
||||
}
|
||||
}
|
||||
|
||||
info!("new settings applied");
|
||||
if output_directory != self.config.output_path || export_pdf != self.config.export_pdf {
|
||||
let config = PdfExportConfig {
|
||||
substitute_pattern: self.config.output_path.clone(),
|
||||
mode: self.config.export_pdf,
|
||||
root: Path::new("").into(),
|
||||
path: None,
|
||||
};
|
||||
|
||||
self.primary().change_export_pdf(config.clone());
|
||||
{
|
||||
let m = self.main.lock();
|
||||
if let Some(main) = m.as_ref() {
|
||||
main.wait().change_export_pdf(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo: watch changes of the root path
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue