Skip to content

Commit

Permalink
fix: language regex
Browse files Browse the repository at this point in the history
closes #21
  • Loading branch information
xhyrom committed Nov 19, 2024
1 parent 79b39ca commit 7da0723
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ tower-lsp = "0.20.0"
git2 = { version = "0.19.0", default-features = false }
serde_json = { version = "1.0.122", features = ["std"] }
lazy_static = "1.5.0"
regex = { version = "1.10.6", default-features = false, features = ["std", "perf", "unicode-case"] }
regex = { version = "1.10.6", default-features = false, features = ["std", "perf", "unicode-case", "unicode-perl"] }
urlencoding = "2.1.3"
14 changes: 14 additions & 0 deletions lsp/src/languages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,17 @@ pub fn get_language(document: &Document) -> String {

String::from("text")
}

#[cfg(test)]
mod tests {
use tower_lsp::lsp_types::Url;

use super::*;

#[test]
fn test_unicode_perl() {
let document = Document::new(Url::parse("file:///home/user/file.php").unwrap());
let lang = get_language(&document);
assert_eq!(lang, "php");
}
}

0 comments on commit 7da0723

Please sign in to comment.