mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-12-23 09:19:21 +00:00
Resolve documents outside of the workspace
This commit is contained in:
parent
bb18080f69
commit
a44697aec4
2 changed files with 27 additions and 1 deletions
|
|
@ -277,7 +277,10 @@ impl<C: LspClient + Send + Sync> jsonrpc::EventHandler for LatexLspServer<C> {
|
|||
for event in self.event_manager.take() {
|
||||
match event {
|
||||
Event::WorkspaceChanged => {
|
||||
log::info!("TODO: Workspace Changed");
|
||||
let workspace = self.workspace_manager.get();
|
||||
workspace.unresolved_includes()
|
||||
.iter()
|
||||
.for_each(|path| self.workspace_manager.load(&path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,6 +133,29 @@ impl Workspace {
|
|||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn unresolved_includes(&self) -> Vec<PathBuf> {
|
||||
let mut includes = Vec::new();
|
||||
for document in &self.documents {
|
||||
if let SyntaxTree::Latex(tree) = &document.tree {
|
||||
for include in &tree.includes {
|
||||
if self.resolve_document(&document.uri, include).is_some() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(targets) = Self::resolve_link_targets(&document.uri, &include) {
|
||||
for target in &targets {
|
||||
let path = PathBuf::from(target);
|
||||
if path.exists() {
|
||||
includes.push(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
includes
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WorkspaceManager {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue