diff options
author | Norbert Preining <norbert@preining.info> | 2024-03-29 03:02:21 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-03-29 03:02:21 +0000 |
commit | 23724df30adf3c6356ee7877833b8096987c643f (patch) | |
tree | a59cd37590258851deb53c4a5ff957cd12c308a0 /support/texlab/crates | |
parent | 79e9e48f9496fe82b7e76b2b318d24e9aab1ca8a (diff) |
CTAN sync 202403290302
Diffstat (limited to 'support/texlab/crates')
-rw-r--r-- | support/texlab/crates/base-db/src/deps/root.rs | 8 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex.rs | 5 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex/tests.rs | 24 | ||||
-rw-r--r-- | support/texlab/crates/texlab/Cargo.toml | 2 |
4 files changed, 37 insertions, 2 deletions
diff --git a/support/texlab/crates/base-db/src/deps/root.rs b/support/texlab/crates/base-db/src/deps/root.rs index 7e2266e68c..442d6f9e35 100644 --- a/support/texlab/crates/base-db/src/deps/root.rs +++ b/support/texlab/crates/base-db/src/deps/root.rs @@ -2,6 +2,8 @@ use url::Url; use crate::{DocumentData, Workspace}; +use super::graph::HOME_DIR; + #[derive(PartialEq, Eq, Clone, Hash)] pub struct ProjectRoot { pub compile_dir: Url, @@ -14,6 +16,10 @@ pub struct ProjectRoot { impl ProjectRoot { pub fn walk_and_find(workspace: &Workspace, dir: &Url) -> Self { + let home_dir = HOME_DIR + .as_deref() + .and_then(|path| Url::from_directory_path(path).ok()); + let mut current = dir.clone(); loop { let root = Self::from_rootfile(workspace, ¤t) @@ -28,7 +34,7 @@ impl ProjectRoot { break Self::from_config(workspace, &dir); }; - if current == parent { + if current == parent || Some(&parent) == home_dir.as_ref() { break Self::from_config(workspace, &dir); } diff --git a/support/texlab/crates/parser/src/latex.rs b/support/texlab/crates/parser/src/latex.rs index 4a6fabae21..a114d3ecba 100644 --- a/support/texlab/crates/parser/src/latex.rs +++ b/support/texlab/crates/parser/src/latex.rs @@ -855,6 +855,11 @@ impl<'a> Parser<'a> { self.builder.start_node(LABEL_DEFINITION.into()); self.eat(); self.trivia(); + + if self.lexer.peek() == Some(Token::LBrack) { + self.brack_group(); + } + if self.lexer.peek() == Some(Token::LCurly) { self.curly_group_word(); } diff --git a/support/texlab/crates/parser/src/latex/tests.rs b/support/texlab/crates/parser/src/latex/tests.rs index 5e1a4044cd..9c086c43fd 100644 --- a/support/texlab/crates/parser/src/latex/tests.rs +++ b/support/texlab/crates/parser/src/latex/tests.rs @@ -2883,6 +2883,30 @@ fn test_label_definition_simple() { } #[test] +fn test_label_definition_options() { + check( + r#"\label[foo]{bar}"#, + expect![[r#" + ROOT@0..16 + PREAMBLE@0..16 + LABEL_DEFINITION@0..16 + COMMAND_NAME@0..6 "\\label" + BRACK_GROUP@6..11 + L_BRACK@6..7 "[" + TEXT@7..10 + WORD@7..10 "foo" + R_BRACK@10..11 "]" + CURLY_GROUP_WORD@11..16 + L_CURLY@11..12 "{" + KEY@12..15 + WORD@12..15 "bar" + R_CURLY@15..16 "}" + + "#]], + ); +} + +#[test] fn test_label_number() { check( r#"\newlabel{foo}{{1.1}}"#, diff --git a/support/texlab/crates/texlab/Cargo.toml b/support/texlab/crates/texlab/Cargo.toml index a78059051e..8fe5d4fbbe 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.14.0" +version = "5.14.1" license.workspace = true readme = "README.md" authors.workspace = true |