From c5a955dd8fcdc8106fbafda4446958f5bb7735bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Sun, 4 Aug 2024 22:59:22 +0200 Subject: [PATCH] fix: base icons url & case insensitive regexes --- README.md | 2 +- lsp/src/configuration.rs | 4 +++- lsp/src/languages.rs | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5d4c7ee..5670072 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You can configure state, details and git integration by changing Discord Presenc "discord_presence": { "initialization_options": { // Base url for all language icons - "base_icons_url": "https://raw.githubusercontent.com/xhyrom/zed-discord-presence/feat/recognize-languages/assets/icons/", + "base_icons_url": "https://raw.githubusercontent.com/xhyrom/zed-discord-presence/main/assets/icons/", "state": "Working on {filename}", "details": "In {workspace}", diff --git a/lsp/src/configuration.rs b/lsp/src/configuration.rs index e9beb20..e159cd8 100644 --- a/lsp/src/configuration.rs +++ b/lsp/src/configuration.rs @@ -57,7 +57,9 @@ macro_rules! set_string { impl Configuration { pub fn new() -> Self { Self { - base_icons_url: String::from("https://raw.githubusercontent.com/xhyrom/zed-discord-presence/feat/recognize-languages/assets/icons/"), + base_icons_url: String::from( + "https://raw.githubusercontent.com/xhyrom/zed-discord-presence/main/assets/icons/", + ), state: Some(String::from("Working on {filename}")), details: Some(String::from("In {workspace}")), large_image: Some(String::from("{base_icons_url}/{language}.png")), diff --git a/lsp/src/languages.rs b/lsp/src/languages.rs index c48abec..4a28cdf 100644 --- a/lsp/src/languages.rs +++ b/lsp/src/languages.rs @@ -1,5 +1,5 @@ use lazy_static::lazy_static; -use regex::Regex; +use regex::{Regex, RegexBuilder}; use serde_json::from_str; use std::collections::HashMap; use std::sync::Mutex; @@ -29,7 +29,10 @@ pub fn get_language(document: &Document) -> String { continue; } - if let Ok(re) = Regex::new(pattern.unwrap()) { + if let Ok(re) = RegexBuilder::new(pattern.unwrap()) + .case_insensitive(true) + .build() + { if re.is_match(&filename) || re.is_match(&extension) { return language.to_string(); }