Skip to content

Commit

Permalink
fix: base icons url & case insensitive regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Aug 4, 2024
1 parent 0810b2c commit c5a955d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
4 changes: 3 additions & 1 deletion lsp/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
7 changes: 5 additions & 2 deletions lsp/src/languages.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit c5a955d

Please sign in to comment.