summaryrefslogtreecommitdiff
path: root/support/texlab/src/features/forward_search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/src/features/forward_search.rs')
-rw-r--r--support/texlab/src/features/forward_search.rs34
1 files changed, 11 insertions, 23 deletions
diff --git a/support/texlab/src/features/forward_search.rs b/support/texlab/src/features/forward_search.rs
index 8e5a2cc59c..350fdd02b9 100644
--- a/support/texlab/src/features/forward_search.rs
+++ b/support/texlab/src/features/forward_search.rs
@@ -32,7 +32,7 @@ pub enum Error {
}
pub struct Command {
- executable: String,
+ program: String,
args: Vec<String>,
}
@@ -76,42 +76,30 @@ impl Command {
return Err(Error::PdfNotFound(pdf_path));
}
- let position = position.unwrap_or_else(|| {
- child
- .contents(db)
- .line_index(db)
- .line_col_lsp(child.cursor(db))
- });
+ let position =
+ position.unwrap_or_else(|| child.line_index(db).line_col_lsp(child.cursor(db)));
- let options = &workspace.options(db).forward_search;
+ let Some(config) = &db.config().synctex else {
+ return Err(Error::Unconfigured);
+ };
- let executable = options
- .executable
- .as_deref()
- .ok_or(Error::Unconfigured)?
- .to_string();
+ let program = config.program.clone();
- let args: Vec<_> = options
+ let args: Vec<_> = config
.args
- .as_deref()
- .ok_or(Error::Unconfigured)?
.iter()
.flat_map(|arg| replace_placeholder(tex_path, &pdf_path, position.line, arg))
.collect();
- Ok(Self { executable, args })
+ Ok(Self { program, args })
}
}
impl Command {
pub fn run(self) -> Result<(), Error> {
- log::debug!(
- "Executing forward search: {} {:?}",
- self.executable,
- self.args
- );
+ log::debug!("Executing forward search: {} {:?}", self.program, self.args);
- std::process::Command::new(self.executable)
+ std::process::Command::new(self.program)
.args(self.args)
.stdin(Stdio::null())
.stdout(Stdio::null())