fix: language regex (#23)

closes https://github.com/xhyrom/zed-discord-presence/issues/21
This commit is contained in:
Jozef Steinhübl 2024-11-19 18:31:02 +01:00 committed by GitHub
parent 79b39ca2ca
commit fd9bd4204d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -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"

View file

@ -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");
}
}