From 326add29024271cbd541ac55448e616e833ae5fa Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 30 Jan 2023 03:04:17 +0000 Subject: CTAN sync 202301300304 --- support/texlab/CHANGELOG.md | 14 +++++++ support/texlab/CONTRIBUTING.md | 5 ++- support/texlab/Cargo.lock | 42 ++++++++++----------- support/texlab/Cargo.toml | 6 +-- support/texlab/src/db/analysis.rs | 10 +++++ support/texlab/src/db/document.rs | 23 ++++++----- support/texlab/src/db/workspace.rs | 2 +- support/texlab/src/features/formatting.rs | 2 + support/texlab/src/features/rename/label.rs | 10 ++--- support/texlab/src/lib.rs | 3 +- support/texlab/src/options.rs | 2 + support/texlab/src/parser/build_log.rs | 12 ++++-- ...b__parser__build_log__tests__parse@003.txt.snap | 8 ++-- ...b__parser__build_log__tests__parse@005.txt.snap | 6 +-- support/texlab/texlab.1 | 4 +- support/texlab/texlab.pdf | Bin 26548 -> 26613 bytes 16 files changed, 93 insertions(+), 56 deletions(-) (limited to 'support') diff --git a/support/texlab/CHANGELOG.md b/support/texlab/CHANGELOG.md index 823998dc84..7e2b02dd02 100644 --- a/support/texlab/CHANGELOG.md +++ b/support/texlab/CHANGELOG.md @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.2.0] - 2023-01-29 + +### Added + +- Include line numbers in build warnings when available ([#840](https://github.com/latex-lsp/texlab/issues/840)) +- Add `none` formatter to `texlab.latexFormatter` and `texlab.bibtexFormatter` options + to allow disabling formatting ([#846](https://github.com/latex-lsp/texlab/issues/846)) + +### Fixed + +- Concatenate more than two lines of maximum length in build diagnostics ([#842](https://github.com/latex-lsp/texlab/pull/842)) +- Apply the correct range of references to labels when renaming ([#841](https://github.com/latex-lsp/texlab/issues/841)) +- Use `document` environment to detect root file instead of `\documentclass` ([#845](https://github.com/latex-lsp/texlab/issues/845)) + ## [5.1.0] - 2023-01-21 ### Added diff --git a/support/texlab/CONTRIBUTING.md b/support/texlab/CONTRIBUTING.md index c80f4f3fa1..353a6c8608 100644 --- a/support/texlab/CONTRIBUTING.md +++ b/support/texlab/CONTRIBUTING.md @@ -1,3 +1,6 @@ # Contributing -When contributing to this repository, please first discuss the change you wish to make on the issue tracker with the owners of this repository before making a change. +Pull requests are welcome. For major changes, please open an issue first +to discuss what you would like to change. + +Please make sure to update tests as appropriate. diff --git a/support/texlab/Cargo.lock b/support/texlab/Cargo.lock index 532a369b42..1b9986b4ad 100644 --- a/support/texlab/Cargo.lock +++ b/support/texlab/Cargo.lock @@ -126,9 +126,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -187,9 +187,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.1" +version = "4.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" dependencies = [ "bitflags", "clap_derive", @@ -425,9 +425,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "encode_unicode" @@ -1013,9 +1013,9 @@ dependencies = [ [[package]] name = "notify" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2c66da08abae1c024c01d635253e402341b4060a12e99b31c7594063bf490a" +checksum = "58ea850aa68a06e48fdb069c0ec44d0d64c8dbffa49bf3b6f7f0a901fdea1ba9" dependencies = [ "bitflags", "crossbeam-channel", @@ -1026,7 +1026,7 @@ dependencies = [ "libc", "mio", "walkdir", - "winapi", + "windows-sys", ] [[package]] @@ -1107,9 +1107,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4257b4a04d91f7e9e6290be5d3da4804dd5784fafde3a497d73eb2b4a158c30a" +checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" dependencies = [ "thiserror", "ucd-trie", @@ -1117,9 +1117,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241cda393b0cdd65e62e07e12454f1f25d57017dcc514b1514cd3c4645e3a0a6" +checksum = "8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea" dependencies = [ "pest", "pest_generator", @@ -1127,9 +1127,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46b53634d8c8196302953c74d5352f33d0c512a9499bd2ce468fc9f4128fa27c" +checksum = "2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f" dependencies = [ "pest", "pest_meta", @@ -1140,9 +1140,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef4f1332a8d4678b41966bb4cc1d0676880e84183a1ecc3f4b69f03e99c7a51" +checksum = "9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d" dependencies = [ "once_cell", "pest", @@ -1304,9 +1304,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -1631,12 +1631,12 @@ dependencies = [ [[package]] name = "texlab" -version = "5.1.0" +version = "5.2.0" dependencies = [ "anyhow", "assert_unordered", "chrono", - "clap 4.1.1", + "clap 4.1.4", "criterion", "crossbeam-channel", "dashmap", diff --git a/support/texlab/Cargo.toml b/support/texlab/Cargo.toml index 480f16aa94..9f5d0e570f 100644 --- a/support/texlab/Cargo.toml +++ b/support/texlab/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "texlab" description = "LaTeX Language Server" -version = "5.1.0" +version = "5.2.0" license = "GPL-3.0" readme = "README.md" authors = [ @@ -36,7 +36,7 @@ doctest = false [dependencies] anyhow = "1.0.68" chrono = { version = "0.4.23", default-features = false, features = ["std"] } -clap = { version = "4.0.32", features = ["derive"] } +clap = { version = "4.1.4", features = ["derive"] } crossbeam-channel = "0.5.6" dashmap = "5.4.0" dirs = "4.0.0" @@ -53,7 +53,7 @@ log = "0.4.17" logos = "0.12.1" lsp-server = "0.7.0" lsp-types = { version = "0.93.2", features = ["proposed"] } -notify = "5.0.0" +notify = "5.1.0" once_cell = "1.17.0" regex = "1.7.1" rowan = "0.15.10" diff --git a/support/texlab/src/db/analysis.rs b/support/texlab/src/db/analysis.rs index 35ee4be2a1..79e81c963c 100644 --- a/support/texlab/src/db/analysis.rs +++ b/support/texlab/src/db/analysis.rs @@ -149,6 +149,16 @@ pub struct TexAnalysis { pub environment_names: Vec, } +#[salsa::tracked] +impl TexAnalysis { + #[salsa::tracked] + pub fn has_document_environment(self, db: &dyn Db) -> bool { + self.environment_names(db) + .iter() + .any(|name| name == "document") + } +} + impl TexAnalysis { pub(super) fn analyze(db: &dyn Db, root: &latex::SyntaxNode) -> Self { let mut links = Vec::new(); diff --git a/support/texlab/src/db/document.rs b/support/texlab/src/db/document.rs index 4ee23a2230..1fc7d6880c 100644 --- a/support/texlab/src/db/document.rs +++ b/support/texlab/src/db/document.rs @@ -175,23 +175,22 @@ impl Document { } #[salsa::tracked] - pub fn can_be_index(self, db: &dyn Db) -> bool { + pub fn can_be_root(self, db: &dyn Db) -> bool { self.parse(db).as_tex().map_or(false, |data| { - data.analyze(db) - .links(db) - .iter() - .filter(|link| link.kind(db) == TexLinkKind::Cls) - .any(|link| link.path(db).text(db) != "subfiles") + let analysis = data.analyze(db); + analysis.has_document_environment(db) + || !analysis + .links(db) + .iter() + .filter(|link| link.kind(db) == TexLinkKind::Cls) + .any(|link| link.path(db).text(db) == "subfiles") }) } #[salsa::tracked] pub fn can_be_built(self, db: &dyn Db) -> bool { - self.parse(db).as_tex().map_or(false, |data| { - data.analyze(db) - .links(db) - .iter() - .any(|link| link.kind(db) == TexLinkKind::Cls) - }) + self.parse(db) + .as_tex() + .map_or(false, |data| data.analyze(db).has_document_environment(db)) } } diff --git a/support/texlab/src/db/workspace.rs b/support/texlab/src/db/workspace.rs index 0fb9745b12..8b4d755b09 100644 --- a/support/texlab/src/db/workspace.rs +++ b/support/texlab/src/db/workspace.rs @@ -67,7 +67,7 @@ impl Workspace { self.documents(db) .iter() .copied() - .filter(|&document| document.can_be_index(db)) + .filter(|&document| document.can_be_root(db)) } pub fn open( diff --git a/support/texlab/src/features/formatting.rs b/support/texlab/src/features/formatting.rs index 09737777fd..5d7d1c0c1f 100644 --- a/support/texlab/src/features/formatting.rs +++ b/support/texlab/src/features/formatting.rs @@ -19,10 +19,12 @@ pub fn format_source_code( let document = workspace.lookup_uri(db, uri)?; match document.language(db) { Language::Tex => match workspace.options(db).latex_formatter { + LatexFormatter::None => None, LatexFormatter::Texlab => None, LatexFormatter::Latexindent => format_with_latexindent(db, document), }, Language::Bib => match workspace.options(db).bibtex_formatter { + BibtexFormatter::None => None, BibtexFormatter::Texlab => format_bibtex_internal(db, document, options), BibtexFormatter::Latexindent => format_with_latexindent(db, document), }, diff --git a/support/texlab/src/features/rename/label.rs b/support/texlab/src/features/rename/label.rs index d38d13ae93..7e596209d8 100644 --- a/support/texlab/src/features/rename/label.rs +++ b/support/texlab/src/features/rename/label.rs @@ -44,24 +44,24 @@ pub(super) fn rename(context: &CursorContext) -> Option { }); if let Some(label) = latex::LabelReferenceRange::cast(node.clone()) { - if let Some(name1) = label + if let Some(name_from) = label .from() .and_then(|name| name.key()) .filter(|name| name.to_string() == name_text) { edits.push(Indel { - delete: latex::small_range(&name1), + delete: latex::small_range(&name_from), insert: context.params.new_name.clone(), }); } - if let Some(name2) = label - .from() + if let Some(name_to) = label + .to() .and_then(|name| name.key()) .filter(|name| name.to_string() == name_text) { edits.push(Indel { - delete: latex::small_range(&name2), + delete: latex::small_range(&name_to), insert: context.params.new_name.clone(), }); } diff --git a/support/texlab/src/lib.rs b/support/texlab/src/lib.rs index 9a7b587ab8..45b96fb265 100644 --- a/support/texlab/src/lib.rs +++ b/support/texlab/src/lib.rs @@ -23,7 +23,7 @@ pub struct Jar( db::LinterData, db::Document, db::Document_parse, - db::Document_can_be_index, + db::Document_can_be_root, db::Document_can_be_built, db::parse::TexDocumentData, db::parse::TexDocumentData_analyze, @@ -35,6 +35,7 @@ pub struct Jar( db::analysis::TheoremEnvironment, db::analysis::GraphicsPath, db::analysis::TexAnalysis, + db::analysis::TexAnalysis_has_document_environment, db::MissingDependencies, db::hidden_dependency, db::source_dependency, diff --git a/support/texlab/src/options.rs b/support/texlab/src/options.rs index cc0058fc68..6cbba51823 100644 --- a/support/texlab/src/options.rs +++ b/support/texlab/src/options.rs @@ -32,6 +32,7 @@ impl Default for DiagnosticsDelay { #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum BibtexFormatter { + None, Texlab, Latexindent, } @@ -45,6 +46,7 @@ impl Default for BibtexFormatter { #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum LatexFormatter { + None, Texlab, Latexindent, } diff --git a/support/texlab/src/parser/build_log.rs b/support/texlab/src/parser/build_log.rs index 5f99129cdb..1e5eca26f8 100644 --- a/support/texlab/src/parser/build_log.rs +++ b/support/texlab/src/parser/build_log.rs @@ -17,8 +17,9 @@ static TEX_ERROR_REGEX: Lazy = Lazy::new(|| { Regex::new("(?m)^! ((?P(.|\r|\n)*?)\r?\nl\\.(?P\\d+)( (\\.\\.\\.)?(?P[^\r\n]+))?|(?P[^\r\n]*))").unwrap() }); -static WARNING_REGEX: Lazy = - Lazy::new(|| Regex::new("(LaTeX|Package [a-zA-Z_\\-]+) Warning: (?P[^\r\n]*)").unwrap()); +static WARNING_REGEX: Lazy = Lazy::new(|| { + Regex::new("(?P(LaTeX|Package [a-zA-Z_\\-]+) Warning: [^\r\n]*?(on input line (?P\\d+))?\\.)[\r\n]").unwrap() +}); static BAD_BOX_REGEX: Lazy = Lazy::new(|| { Regex::new("(?P(Ov|Und)erfull \\\\[hv]box[^\r\n]*lines? (?P\\d+)[^\r\n]*)").unwrap() @@ -104,8 +105,11 @@ fn prepare_log(log: &str) -> String { } else if line.chars().count() == MAX_LINE_LENGTH { let mut new_line = String::new(); new_line.push_str(line); - if let Some(old_line) = old_lines.next() { - new_line.push_str(old_line); + while let Some(old_line) = old_lines.next() { + new_line.push_str(old_line); + if old_line.chars().count() != MAX_LINE_LENGTH { + break; + } } new_lines.push(new_line); } else { diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap index d2024a8cd3..22d2ca86e5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap +++ b/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap @@ -8,14 +8,16 @@ BuildLog { BuildError { relative_path: "./parent.tex", level: Warning, - message: "Citation `foo' on page 1 undefined on input line 6.", + message: "LaTeX Warning: Citation `foo' on page 1 undefined on input line 6.", hint: None, - line: None, + line: Some( + 5, + ), }, BuildError { relative_path: "./parent.tex", level: Warning, - message: "There were undefined references.", + message: "LaTeX Warning: There were undefined references.", hint: None, line: None, }, diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap index e4857d00d8..b77926323c 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap +++ b/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap @@ -8,21 +8,21 @@ BuildLog { BuildError { relative_path: "./parent.tex", level: Warning, - message: "'babel/polyglossia' detected but 'csquotes' missing. Loading 'csquotes' recommended.", + message: "Package biblatex Warning: 'babel/polyglossia' detected but 'csquotes' missing. Loading 'csquotes' recommended.", hint: None, line: None, }, BuildError { relative_path: "./parent.tex", level: Warning, - message: "There were undefined references.", + message: "LaTeX Warning: There were undefined references.", hint: None, line: None, }, BuildError { relative_path: "./parent.tex", level: Warning, - message: "Please (re)run Biber on the file: parent and rerun LaTeX afterwards.", + message: "Package biblatex Warning: Please (re)run Biber on the file: parent and rerun LaTeX afterwards.", hint: None, line: None, }, diff --git a/support/texlab/texlab.1 b/support/texlab/texlab.1 index edbd84b65c..692333db81 100644 --- a/support/texlab/texlab.1 +++ b/support/texlab/texlab.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. -.TH TEXLAB "1" "January 2023" "texlab 5.1.0" "User Commands" +.TH TEXLAB "1" "January 2023" "texlab 5.2.0" "User Commands" .SH NAME -texlab \- manual page for texlab 5.1.0 +texlab \- manual page for texlab 5.2.0 .SH SYNOPSIS .B texlab [\fI\,OPTIONS\/\fR] diff --git a/support/texlab/texlab.pdf b/support/texlab/texlab.pdf index cebcaf4269..4830be200f 100644 Binary files a/support/texlab/texlab.pdf and b/support/texlab/texlab.pdf differ -- cgit v1.2.3