diff options
author | Norbert Preining <norbert@preining.info> | 2024-03-25 03:03:04 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-03-25 03:03:04 +0000 |
commit | 05f8146ef2eea2cd71b9c96583c6d893e6c76af5 (patch) | |
tree | 615019c00dc1d5e6ec2636bbbb30852f241c04ee /support/texlab/crates/diagnostics | |
parent | 1feacf4295bab2d8f05aa0f5fbd1d902559bef36 (diff) |
CTAN sync 202403250302
Diffstat (limited to 'support/texlab/crates/diagnostics')
-rw-r--r-- | support/texlab/crates/diagnostics/Cargo.toml | 3 | ||||
-rw-r--r-- | support/texlab/crates/diagnostics/src/build_log.rs | 4 | ||||
-rw-r--r-- | support/texlab/crates/diagnostics/src/chktex.rs | 12 | ||||
-rw-r--r-- | support/texlab/crates/diagnostics/src/citations.rs | 3 | ||||
-rw-r--r-- | support/texlab/crates/diagnostics/src/labels.rs | 14 | ||||
-rw-r--r-- | support/texlab/crates/diagnostics/src/manager.rs | 4 |
6 files changed, 19 insertions, 21 deletions
diff --git a/support/texlab/crates/diagnostics/Cargo.toml b/support/texlab/crates/diagnostics/Cargo.toml index 91c2ff9dbd..5a2a7a7e28 100644 --- a/support/texlab/crates/diagnostics/Cargo.toml +++ b/support/texlab/crates/diagnostics/Cargo.toml @@ -7,9 +7,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -anyhow = "1.0.75" base-db = { path = "../base-db" } -dirs = "5.0.1" encoding_rs = "0.8.33" encoding_rs_io = "0.1.7" itertools = "0.12.0" @@ -17,7 +15,6 @@ line-index = { path = "../line-index" } log = "0.4.21" multimap = "0.10.0" once_cell = "1.19.0" -parking_lot = "0.12.1" regex = "1.10.2" rowan = "0.15.15" rustc-hash = "1.1.0" diff --git a/support/texlab/crates/diagnostics/src/build_log.rs b/support/texlab/crates/diagnostics/src/build_log.rs index 352e18d0d1..f4180f3978 100644 --- a/support/texlab/crates/diagnostics/src/build_log.rs +++ b/support/texlab/crates/diagnostics/src/build_log.rs @@ -1,4 +1,4 @@ -use base_db::{Document, Workspace}; +use base_db::{deps, Document, Workspace}; use line_index::LineCol; use multimap::MultiMap; use rowan::{TextLen, TextRange, TextSize}; @@ -17,7 +17,7 @@ pub fn update( let data = log_document.data.as_log()?; - let parents = workspace.parents(log_document); + let parents = deps::parents(workspace, log_document); let root_document = parents.iter().next()?; let base_path = root_document diff --git a/support/texlab/crates/diagnostics/src/chktex.rs b/support/texlab/crates/diagnostics/src/chktex.rs index a342f78349..195ea968e5 100644 --- a/support/texlab/crates/diagnostics/src/chktex.rs +++ b/support/texlab/crates/diagnostics/src/chktex.rs @@ -4,7 +4,10 @@ use std::{ process::Stdio, }; -use base_db::{Document, Workspace}; +use base_db::{ + deps::{self, ProjectRoot}, + Document, Workspace, +}; use encoding_rs_io::DecodeReaderBytesBuilder; use line_index::LineCol; use once_cell::sync::Lazy; @@ -23,8 +26,7 @@ impl Command { pub fn new(workspace: &Workspace, document: &Document) -> Option<Self> { document.data.as_tex()?; - let parent = workspace - .parents(document) + let parent = deps::parents(workspace, document) .into_iter() .next() .unwrap_or(document); @@ -34,7 +36,9 @@ impl Command { return None; } - let working_dir = workspace.current_dir(&parent.dir).to_file_path().ok()?; + let root = ProjectRoot::walk_and_find(workspace, &parent.dir); + + let working_dir = root.src_dir.to_file_path().ok()?; log::debug!("Calling ChkTeX from directory: {}", working_dir.display()); let text = document.text.clone(); diff --git a/support/texlab/crates/diagnostics/src/citations.rs b/support/texlab/crates/diagnostics/src/citations.rs index ea4ef03d58..84b9a10b1c 100644 --- a/support/texlab/crates/diagnostics/src/citations.rs +++ b/support/texlab/crates/diagnostics/src/citations.rs @@ -1,7 +1,8 @@ use base_db::{ + deps::Project, semantics::{bib::Entry, tex::Citation}, util::queries::{self, Object}, - Document, Project, Workspace, + Document, Workspace, }; use rustc_hash::{FxHashMap, FxHashSet}; use url::Url; diff --git a/support/texlab/crates/diagnostics/src/labels.rs b/support/texlab/crates/diagnostics/src/labels.rs index 9a39f3f24b..15b5aaad00 100644 --- a/support/texlab/crates/diagnostics/src/labels.rs +++ b/support/texlab/crates/diagnostics/src/labels.rs @@ -13,11 +13,6 @@ pub fn detect_undefined_and_unused_labels( workspace: &Workspace, results: &mut FxHashMap<Url, Vec<Diagnostic>>, ) { - let graphs: Vec<_> = workspace - .iter() - .map(|start| base_db::graph::Graph::new(workspace, start)) - .collect(); - for document in workspace.iter() { let DocumentData::Tex(data) = &document.data else { continue; @@ -25,10 +20,11 @@ pub fn detect_undefined_and_unused_labels( let mut label_refs = FxHashSet::default(); let mut label_defs = FxHashSet::default(); - let project = graphs - .iter() - .filter(|graph| graph.preorder().contains(&document)) - .flat_map(|graph| graph.preorder()); + let project = workspace + .graphs() + .values() + .filter(|graph| graph.preorder(workspace).contains(&document)) + .flat_map(|graph| graph.preorder(workspace)); for label in project .filter_map(|child| child.data.as_tex()) diff --git a/support/texlab/crates/diagnostics/src/manager.rs b/support/texlab/crates/diagnostics/src/manager.rs index 38c0a514f4..81347410c1 100644 --- a/support/texlab/crates/diagnostics/src/manager.rs +++ b/support/texlab/crates/diagnostics/src/manager.rs @@ -1,4 +1,4 @@ -use base_db::{util::filter_regex_patterns, Document, Owner, Workspace}; +use base_db::{deps::Project, util::filter_regex_patterns, Document, Owner, Workspace}; use multimap::MultiMap; use rustc_hash::FxHashMap; use url::Url; @@ -66,7 +66,7 @@ impl Manager { .iter() .filter(|document| Self::is_relevant(document)) { - let project = workspace.project(document); + let project = Project::from_child(workspace, document); super::citations::detect_undefined_citations(&project, document, &mut results); super::citations::detect_unused_entries(&project, document, &mut results); } |