diff options
author | Norbert Preining <norbert@preining.info> | 2024-01-21 03:01:05 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-01-21 03:01:05 +0000 |
commit | b2fc73208c72c65ca8f9ce068898291b69322d32 (patch) | |
tree | c5027d520af6b383a642459af510e38224cf97d5 /support | |
parent | 2fd07558ccd8d3c8e354f8ea0b342ef7ac1e87a3 (diff) |
CTAN sync 202401210301
Diffstat (limited to 'support')
32 files changed, 177 insertions, 118 deletions
diff --git a/support/TeX4ht/source/ChangeLog b/support/TeX4ht/source/ChangeLog index 319d184bf6..32a7563f98 100644 --- a/support/TeX4ht/source/ChangeLog +++ b/support/TeX4ht/source/ChangeLog @@ -1,3 +1,8 @@ +2024-01-19 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-4ht.tex (siunitx.4ht): require the Color package. + https://tex.stackexchange.com/q/707416/2891 + 2024-01-16 Michal Hoftich <michal.h21@gmail.com> * tex4ht-4ht.tex (unicode-math-hooks.4ht): added support for various diff --git a/support/TeX4ht/source/tex4ht-4ht.tex b/support/TeX4ht/source/tex4ht-4ht.tex index 113c21f337..2b6a8431da 100644 --- a/support/TeX4ht/source/tex4ht-4ht.tex +++ b/support/TeX4ht/source/tex4ht-4ht.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-4ht.tex 1444 2024-01-16 16:58:10Z michal_h21 $ +% $Id: tex4ht-4ht.tex 1445 2024-01-19 11:16:04Z michal_h21 $ % tex tex4ht-4ht or ht tex tex4ht-4ht % % Copyright 2009-2024 TeX Users Group @@ -30714,11 +30714,20 @@ What \Verb+\put@line+ of the 08 version does? % siunitx.4ht (|version), generated from |jobname.tex % Copyright 2021-2024 TeX Users Group |<TeX4ht license text|> +|<siunitx require color|> |<siunitx ang|> \Hinput{siunitx} \endinput >>> \AddFile{9}{siunitx} +In the ODT output, Siunitx leads to some catcode errors. It is caused by +requiring of the Color package at begin document. The simple fix for +that is to require color earlier. + +\<siunitx require color\><<< +\RequirePackage{color} +>>> + This should bring support for the \Verb+\ang+ command, which can be used to input angles. diff --git a/support/texlab/CHANGELOG.md b/support/texlab/CHANGELOG.md index f2eb115b20..3a2771ebfd 100644 --- a/support/texlab/CHANGELOG.md +++ b/support/texlab/CHANGELOG.md @@ -5,6 +5,13 @@ 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.12.2] - 2024-01-20 + +### Fixed + +- Fix parsing commands when they are used with subscript ([#990](https://github.com/latex-lsp/texlab/issues/990)) +- Don't append a newline each time a BibTeX document is being formatted ([#996](https://github.com/latex-lsp/texlab/issues/996)) + ## [5.12.1] - 2024-01-04 ### Fixed diff --git a/support/texlab/Cargo.lock b/support/texlab/Cargo.lock index be53fc7b1e..8a130372d7 100644 --- a/support/texlab/Cargo.lock +++ b/support/texlab/Cargo.lock @@ -390,11 +390,10 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] @@ -424,12 +423,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "definition" @@ -656,9 +652,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" @@ -921,9 +917,9 @@ dependencies = [ [[package]] name = "lsp-server" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52dccdf3302eefab8c8a1273047f0a3c3dca4b527c8458d00c09484c8371928" +checksum = "248f65b78f6db5d8e1b1604b4098a28b43d21a8eb1deeca22b1c421b276c7095" dependencies = [ "crossbeam-channel", "log", @@ -1034,9 +1030,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -1161,18 +1157,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1308,9 +1304,9 @@ dependencies = [ [[package]] name = "rowan" -version = "0.15.13" +version = "0.15.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "906057e449592587bf6724f00155bf82a6752c868d78a8fb3aa41f4e6357cfe8" +checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49" dependencies = [ "countme", "hashbrown", @@ -1361,18 +1357,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", @@ -1457,9 +1453,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1500,7 +1496,7 @@ dependencies = [ [[package]] name = "texlab" -version = "5.12.1" +version = "5.12.2" dependencies = [ "anyhow", "base-db", @@ -1555,18 +1551,18 @@ checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", diff --git a/support/texlab/crates/base-db/Cargo.toml b/support/texlab/crates/base-db/Cargo.toml index f5e2c07829..0aceff8e5f 100644 --- a/support/texlab/crates/base-db/Cargo.toml +++ b/support/texlab/crates/base-db/Cargo.toml @@ -14,11 +14,11 @@ itertools = "0.12.0" line-index = { path = "../line-index" } log = "0.4.20" notify = "6.0.1" -once_cell = "1.18.0" +once_cell = "1.19.0" parser = { path = "../parser" } percent-encoding = "2.3.0" regex = "1.10.2" -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } url = "2.5.0" diff --git a/support/texlab/crates/base-db/src/config.rs b/support/texlab/crates/base-db/src/config.rs index 7c4187f7d2..9814e3e674 100644 --- a/support/texlab/crates/base-db/src/config.rs +++ b/support/texlab/crates/base-db/src/config.rs @@ -1,4 +1,3 @@ -use std::path::PathBuf; use std::time::Duration; use parser::SyntaxConfig; @@ -26,7 +25,7 @@ pub struct BuildConfig { pub aux_dir: String, pub log_dir: String, pub pdf_dir: String, - pub output_filename: Option<PathBuf>, + pub output_filename: Option<String>, } #[derive(Debug)] diff --git a/support/texlab/crates/bibfmt/Cargo.toml b/support/texlab/crates/bibfmt/Cargo.toml index 18a4eb6dca..686e871d58 100644 --- a/support/texlab/crates/bibfmt/Cargo.toml +++ b/support/texlab/crates/bibfmt/Cargo.toml @@ -7,7 +7,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -rowan = "0.15.13" +rowan = "0.15.15" syntax = { path = "../syntax" } line-index = { path = "../line-index" } diff --git a/support/texlab/crates/bibtex-utils/Cargo.toml b/support/texlab/crates/bibtex-utils/Cargo.toml index 1789a9747b..8b115bf207 100644 --- a/support/texlab/crates/bibtex-utils/Cargo.toml +++ b/support/texlab/crates/bibtex-utils/Cargo.toml @@ -10,7 +10,7 @@ rust-version.workspace = true chrono = { version = "0.4.26", default-features = false, features = ["std"] } human_name = "2.0.2" itertools = "0.12.0" -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } unicode-normalization = "0.1.22" diff --git a/support/texlab/crates/citeproc/Cargo.toml b/support/texlab/crates/citeproc/Cargo.toml index cccbd002c4..c87b2d17c3 100644 --- a/support/texlab/crates/citeproc/Cargo.toml +++ b/support/texlab/crates/citeproc/Cargo.toml @@ -10,7 +10,7 @@ rust-version.workspace = true bibtex-utils = { path = "../bibtex-utils" } isocountry = "0.3.2" itertools = "0.12.0" -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } titlecase = "2.2.1" diff --git a/support/texlab/crates/commands/Cargo.toml b/support/texlab/crates/commands/Cargo.toml index 2b010ec126..c54d77abf4 100644 --- a/support/texlab/crates/commands/Cargo.toml +++ b/support/texlab/crates/commands/Cargo.toml @@ -10,14 +10,14 @@ rust-version.workspace = true anyhow = "1.0.72" base-db = { path = "../base-db" } bstr = "1.8.0" -crossbeam-channel = "0.5.8" +crossbeam-channel = "0.5.11" itertools = "0.12.0" libc = "0.2.150" log = "0.4.19" -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } -thiserror = "1.0.50" +thiserror = "1.0.56" url = "2.5.0" [dev-dependencies] diff --git a/support/texlab/crates/commands/src/fwd_search.rs b/support/texlab/crates/commands/src/fwd_search.rs index 7e82f38487..4e3450681c 100644 --- a/support/texlab/crates/commands/src/fwd_search.rs +++ b/support/texlab/crates/commands/src/fwd_search.rs @@ -1,11 +1,7 @@ -use std::{ - ffi::OsStr, - path::{Path, PathBuf}, - process::Stdio, -}; +use std::{path::PathBuf, process::Stdio}; use anyhow::Result; -use base_db::Workspace; +use base_db::{Document, Workspace}; use thiserror::Error; use url::Url; @@ -44,62 +40,82 @@ impl ForwardSearch { uri: &Url, line: Option<u32>, ) -> Result<Self, ForwardSearchError> { - let Some(config) = &workspace.config().synctex else { - return Err(ForwardSearchError::Unconfigured); - }; - - let Some(child) = workspace.lookup(uri) else { - return Err(ForwardSearchError::TexNotFound(uri.clone())); - }; - - let parents = workspace.parents(child); - let parent = parents.into_iter().next().unwrap_or(child); - if parent.uri.scheme() != "file" { - return Err(ForwardSearchError::NotLocal(parent.uri.clone())); - } - - let dir = workspace - .pdf_dir(&workspace.current_dir(&parent.dir)) - .to_file_path() - .unwrap(); + log::debug!("[FwdSearch] Preparing forward search: document={uri}, line={line:#?}"); + let synctex_config = workspace + .config() + .synctex + .as_ref() + .ok_or(ForwardSearchError::Unconfigured)?; - let Some(tex_path) = &child.path else { - return Err(ForwardSearchError::InvalidPath(child.uri.clone())); - }; + log::debug!("[FwdSearch] synctex_config={:?}", synctex_config); - let override_path = workspace.config().build.output_filename.as_deref(); + let child = workspace + .lookup(uri) + .ok_or_else(|| ForwardSearchError::TexNotFound(uri.clone()))?; - let Some(pdf_path) = override_path - .or(parent.path.as_deref()) - .and_then(Path::file_stem) - .and_then(OsStr::to_str) - .map(|stem| dir.join(format!("{stem}.pdf"))) - else { - return Err(ForwardSearchError::InvalidPath(parent.uri.clone())); - }; + let parent = workspace.parents(child).into_iter().next().unwrap_or(child); - if !pdf_path.exists() { - return Err(ForwardSearchError::PdfNotFound(pdf_path)); - } + log::debug!("[FwdSearch] root_document={}", parent.uri,); - let tex_path = tex_path.to_string_lossy().into_owned(); + let pdf_path = Self::find_pdf(workspace, parent)?; let pdf_path = pdf_path.to_string_lossy().into_owned(); + let tex_path = child + .path + .as_deref() + .ok_or_else(|| ForwardSearchError::InvalidPath(child.uri.clone()))?; + let tex_path = tex_path.to_string_lossy().into_owned(); + let line = line.unwrap_or(child.cursor.line); let line = (line + 1).to_string(); - let program = config.program.clone(); + let program = synctex_config.program.clone(); let args = replace_placeholders( - &config.args, + &synctex_config.args, &[('f', &tex_path), ('p', &pdf_path), ('l', &line)], ); Ok(Self { program, args }) } + + fn find_pdf(workspace: &Workspace, document: &Document) -> Result<PathBuf, ForwardSearchError> { + let base_dir = workspace.current_dir(&document.dir); + let pdf_dir = workspace.pdf_dir(&base_dir); + + log::debug!("[FwdSearch] base_dir={base_dir}, pdf_dir={pdf_dir}"); + + let pdf_dir = pdf_dir + .to_file_path() + .map_err(|()| ForwardSearchError::InvalidPath(document.uri.clone()))?; + + let pdf_name_override = workspace.config().build.output_filename.clone(); + log::debug!("[FwdSearch] pdf_name_override={pdf_name_override:?}"); + + let pdf_name = pdf_name_override + .or_else(|| { + let stem = document.path.as_ref()?.file_stem()?; + Some(format!("{}.pdf", stem.to_string_lossy())) + }) + .ok_or_else(|| ForwardSearchError::InvalidPath(document.uri.clone()))?; + + let pdf_path = pdf_dir.join(&pdf_name); + let pdf_exists = pdf_path.exists(); + + log::debug!("[FwdSearch] pdf_path={pdf_path:?}, pdf_exists={pdf_exists}"); + if !pdf_exists { + return Err(ForwardSearchError::PdfNotFound(pdf_path)); + } + + Ok(pdf_path) + } } impl ForwardSearch { pub fn run(self) -> Result<(), ForwardSearchError> { - log::debug!("Executing forward search: {} {:?}", self.program, self.args); + log::debug!( + "[FwdSearch] Executing command: {} {:?}", + self.program, + self.args + ); std::process::Command::new(self.program) .args(self.args) diff --git a/support/texlab/crates/completion-data/Cargo.toml b/support/texlab/crates/completion-data/Cargo.toml index 56f78314b0..c32c02d3bc 100644 --- a/support/texlab/crates/completion-data/Cargo.toml +++ b/support/texlab/crates/completion-data/Cargo.toml @@ -9,9 +9,9 @@ rust-version.workspace = true [dependencies] flate2 = "1.0.28" itertools = "0.12.0" -once_cell = "1.18.0" +once_cell = "1.19.0" rustc-hash = "1.1.0" -serde = { version = "1.0.193", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } serde_json = "1.0.108" [lib] diff --git a/support/texlab/crates/completion/Cargo.toml b/support/texlab/crates/completion/Cargo.toml index d44e87db1e..5bcebea435 100644 --- a/support/texlab/crates/completion/Cargo.toml +++ b/support/texlab/crates/completion/Cargo.toml @@ -12,7 +12,7 @@ completion-data = { path = "../completion-data" } fuzzy-matcher = { version = "0.3.7", features = ["compact"] } line-index = { path = "../line-index" } rayon = "1.7.0" -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } url = "2.5.0" diff --git a/support/texlab/crates/definition/Cargo.toml b/support/texlab/crates/definition/Cargo.toml index c3549495ed..d8c4aa3a49 100644 --- a/support/texlab/crates/definition/Cargo.toml +++ b/support/texlab/crates/definition/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } diff --git a/support/texlab/crates/diagnostics/Cargo.toml b/support/texlab/crates/diagnostics/Cargo.toml index 490bee32f3..7de9c6042d 100644 --- a/support/texlab/crates/diagnostics/Cargo.toml +++ b/support/texlab/crates/diagnostics/Cargo.toml @@ -10,7 +10,7 @@ rust-version.workspace = true base-db = { path = "../base-db" } itertools = "0.12.0" line-index = { path = "../line-index" } -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } url = "2.5.0" diff --git a/support/texlab/crates/folding/Cargo.toml b/support/texlab/crates/folding/Cargo.toml index e7646b61a8..500e80f5b2 100644 --- a/support/texlab/crates/folding/Cargo.toml +++ b/support/texlab/crates/folding/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } -rowan = "0.15.13" +rowan = "0.15.15" syntax = { path = "../syntax" } [dev-dependencies] diff --git a/support/texlab/crates/highlights/Cargo.toml b/support/texlab/crates/highlights/Cargo.toml index e3247e50fd..a7f58d1d19 100644 --- a/support/texlab/crates/highlights/Cargo.toml +++ b/support/texlab/crates/highlights/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } -rowan = "0.15.13" +rowan = "0.15.15" [dev-dependencies] expect-test = "1.4.1" diff --git a/support/texlab/crates/hover/Cargo.toml b/support/texlab/crates/hover/Cargo.toml index af8f4f566b..ebc2522c08 100644 --- a/support/texlab/crates/hover/Cargo.toml +++ b/support/texlab/crates/hover/Cargo.toml @@ -11,7 +11,7 @@ base-db = { path = "../base-db" } bibtex-utils = { path = "../bibtex-utils" } citeproc = { path = "../citeproc" } completion-data = { path = "../completion-data" } -rowan = "0.15.13" +rowan = "0.15.15" syntax = { path = "../syntax" } [dev-dependencies] diff --git a/support/texlab/crates/inlay-hints/Cargo.toml b/support/texlab/crates/inlay-hints/Cargo.toml index 06a525a2f3..5547f5649a 100644 --- a/support/texlab/crates/inlay-hints/Cargo.toml +++ b/support/texlab/crates/inlay-hints/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" [dev-dependencies] diff --git a/support/texlab/crates/parser/Cargo.toml b/support/texlab/crates/parser/Cargo.toml index 47ab9bc721..c3e31b7022 100644 --- a/support/texlab/crates/parser/Cargo.toml +++ b/support/texlab/crates/parser/Cargo.toml @@ -8,9 +8,9 @@ rust-version.workspace = true [dependencies] logos = "0.13.0" -once_cell = "1.18.0" +once_cell = "1.19.0" regex = "1.10.2" -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } tempfile = "3.8.1" diff --git a/support/texlab/crates/parser/src/latex/lexer/types.rs b/support/texlab/crates/parser/src/latex/lexer/types.rs index 7ce079d23e..27ae874d9d 100644 --- a/support/texlab/crates/parser/src/latex/lexer/types.rs +++ b/support/texlab/crates/parser/src/latex/lexer/types.rs @@ -51,7 +51,7 @@ pub enum Token { fn lex_command_name(lexer: &mut logos::Lexer<Token>) -> CommandName { let input = &lexer.source()[lexer.span().end..]; - let mut chars = input.chars(); + let mut chars = input.chars().peekable(); let Some(c) = chars.next() else { return CommandName::Generic; }; @@ -65,7 +65,7 @@ fn lex_command_name(lexer: &mut logos::Lexer<Token>) -> CommandName { return CommandName::Generic; } - for c in chars { + while let Some(c) = chars.next() { match c { '*' => { lexer.bump(c.len_utf8()); @@ -74,13 +74,20 @@ fn lex_command_name(lexer: &mut logos::Lexer<Token>) -> CommandName { c if c.is_alphanumeric() => { lexer.bump(c.len_utf8()); } - '@' | ':' | '_' => { + '_' => { + if !matches!(chars.peek(), Some(c) if c.is_alphanumeric()) { + break; + } + + lexer.bump(c.len_utf8()); + } + '@' | ':' => { lexer.bump(c.len_utf8()); } _ => { break; } - }; + } } CommandName::Generic diff --git a/support/texlab/crates/parser/src/latex/tests.rs b/support/texlab/crates/parser/src/latex/tests.rs index a907efc6c3..6e5019776f 100644 --- a/support/texlab/crates/parser/src/latex/tests.rs +++ b/support/texlab/crates/parser/src/latex/tests.rs @@ -3521,3 +3521,24 @@ fn test_theorem_definition_thmtools() { "#]], ); } + +#[test] +fn test_command_subscript() { + check( + r#"\foo_bar \foo_\bar"#, + expect![[r#" + ROOT@0..18 + PREAMBLE@0..18 + GENERIC_COMMAND@0..9 + COMMAND_NAME@0..8 "\\foo_bar" + WHITESPACE@8..9 " " + GENERIC_COMMAND@9..13 + COMMAND_NAME@9..13 "\\foo" + TEXT@13..14 + WORD@13..14 "_" + GENERIC_COMMAND@14..18 + COMMAND_NAME@14..18 "\\bar" + + "#]], + ); +} diff --git a/support/texlab/crates/references/Cargo.toml b/support/texlab/crates/references/Cargo.toml index 49827f8d12..b2d80d49ee 100644 --- a/support/texlab/crates/references/Cargo.toml +++ b/support/texlab/crates/references/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } -rowan = "0.15.13" +rowan = "0.15.15" syntax = { path = "../syntax" } [dev-dependencies] diff --git a/support/texlab/crates/rename/Cargo.toml b/support/texlab/crates/rename/Cargo.toml index 127b3316d7..1b2b91ee2a 100644 --- a/support/texlab/crates/rename/Cargo.toml +++ b/support/texlab/crates/rename/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" syntax = { path = "../syntax" } diff --git a/support/texlab/crates/symbols/Cargo.toml b/support/texlab/crates/symbols/Cargo.toml index 5386efdcf9..d297703d3b 100644 --- a/support/texlab/crates/symbols/Cargo.toml +++ b/support/texlab/crates/symbols/Cargo.toml @@ -14,7 +14,7 @@ base-db = { path = "../base-db" } distro = { path = "../distro" } itertools = "0.12.0" line-index = { path = "../line-index" } -rowan = "0.15.13" +rowan = "0.15.15" syntax = { path = "../syntax" } titlecase = "2.2.1" url = "2.5.0" diff --git a/support/texlab/crates/syntax/Cargo.toml b/support/texlab/crates/syntax/Cargo.toml index 5e6c69409a..aaad7e973e 100644 --- a/support/texlab/crates/syntax/Cargo.toml +++ b/support/texlab/crates/syntax/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] itertools = "0.12.0" -rowan = "0.15.13" +rowan = "0.15.15" [lib] doctest = false diff --git a/support/texlab/crates/test-utils/Cargo.toml b/support/texlab/crates/test-utils/Cargo.toml index 16a0099b04..b08d9cc09f 100644 --- a/support/texlab/crates/test-utils/Cargo.toml +++ b/support/texlab/crates/test-utils/Cargo.toml @@ -10,7 +10,7 @@ rust-version.workspace = true base-db = { path = "../base-db" } distro = { path = "../distro" } line-index = { path = "../line-index" } -rowan = "0.15.13" +rowan = "0.15.15" url = "2.5.0" [lib] diff --git a/support/texlab/crates/texlab/Cargo.toml b/support/texlab/crates/texlab/Cargo.toml index 45f6e6b418..0162fe499a 100644 --- a/support/texlab/crates/texlab/Cargo.toml +++ b/support/texlab/crates/texlab/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "texlab" description = "LaTeX Language Server" -version = "5.12.1" +version = "5.12.2" license.workspace = true readme = "README.md" authors.workspace = true @@ -30,7 +30,7 @@ clap = { version = "4.4.10", features = ["derive"] } commands = { path = "../commands" } completion = { path = "../completion" } completion-data = { path = "../completion-data" } -crossbeam-channel = "0.5.8" +crossbeam-channel = "0.5.11" definition = { path = "../definition" } diagnostics = { path = "../diagnostics" } distro = { path = "../distro" } @@ -44,19 +44,19 @@ inlay-hints = { path = "../inlay-hints" } line-index = { path = "../line-index" } links = { path = "../links" } log = "0.4.19" -lsp-server = "0.7.4" +lsp-server = "0.7.6" lsp-types = "0.94.1" notify = "6.1.1" notify-debouncer-full = "0.3.1" -once_cell = "1.18.0" +once_cell = "1.19.0" parking_lot = "0.12.1" parser = { path = "../parser" } references = { path = "../references" } regex = "1.10.2" rename = { path = "../rename" } -rowan = "0.15.13" +rowan = "0.15.15" rustc-hash = "1.1.0" -serde = "1.0.193" +serde = "1.0.195" serde_json = "1.0.108" serde_regex = "1.1.0" serde_repr = "0.1.17" diff --git a/support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs b/support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs index 0070765b4b..8d5894c256 100644 --- a/support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs +++ b/support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs @@ -1,6 +1,6 @@ use base_db::{Document, Workspace}; use lsp_types::{FormattingOptions, TextEdit}; -use rowan::{TextLen, TextRange}; +use rowan::TextLen; use crate::util::line_index_ext::LineIndexExt; @@ -17,7 +17,7 @@ pub fn format_bibtex_internal( }; let output = bibfmt::format(&data.root_node(), &document.line_index, &options); - let range = TextRange::new(0.into(), document.text.text_len()); - let range = document.line_index.line_col_lsp_range(range)?; + let end = document.line_index.line_col_lsp(document.text.text_len())?; + let range = lsp_types::Range::new(lsp_types::Position::new(0, 0), end); Some(vec![lsp_types::TextEdit::new(range, output)]) } diff --git a/support/texlab/crates/texlab/src/server/options.rs b/support/texlab/crates/texlab/src/server/options.rs index c718e49c16..72b2b127fb 100644 --- a/support/texlab/crates/texlab/src/server/options.rs +++ b/support/texlab/crates/texlab/src/server/options.rs @@ -1,4 +1,3 @@ -use std::path::PathBuf; use std::time::Duration; use base_db::{Config, Formatter, SynctexConfig}; @@ -187,7 +186,7 @@ impl From<Options> for Config { .log_directory .unwrap_or_else(|| config.build.pdf_dir.clone()); - config.build.output_filename = value.build.filename.map(PathBuf::from); + config.build.output_filename = value.build.filename; config.diagnostics.allowed_patterns = value .diagnostics diff --git a/support/texlab/texlab.1 b/support/texlab/texlab.1 index a602e6aa16..97e9fa5a96 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 2024" "texlab 5.12.1" "User Commands" +.TH TEXLAB "1" "January 2024" "texlab 5.12.2" "User Commands" .SH NAME -texlab \- manual page for texlab 5.12.1 +texlab \- manual page for texlab 5.12.2 .SH SYNOPSIS .B texlab [\fI\,OPTIONS\/\fR] diff --git a/support/texlab/texlab.pdf b/support/texlab/texlab.pdf Binary files differindex 00007f6652..0ba7e1348e 100644 --- a/support/texlab/texlab.pdf +++ b/support/texlab/texlab.pdf |