mirror of
https://github.com/xHyroM/zed-discord-presence.git
synced 2024-11-10 00:18:06 +01:00
fix: base icons url & case insensitive regexes
This commit is contained in:
parent
0810b2c79a
commit
c5a955dd8f
3 changed files with 9 additions and 4 deletions
|
@ -24,7 +24,7 @@ You can configure state, details and git integration by changing Discord Presenc
|
||||||
"discord_presence": {
|
"discord_presence": {
|
||||||
"initialization_options": {
|
"initialization_options": {
|
||||||
// Base url for all language icons
|
// 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}",
|
"state": "Working on {filename}",
|
||||||
"details": "In {workspace}",
|
"details": "In {workspace}",
|
||||||
|
|
|
@ -57,7 +57,9 @@ macro_rules! set_string {
|
||||||
impl Configuration {
|
impl Configuration {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
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}")),
|
state: Some(String::from("Working on {filename}")),
|
||||||
details: Some(String::from("In {workspace}")),
|
details: Some(String::from("In {workspace}")),
|
||||||
large_image: Some(String::from("{base_icons_url}/{language}.png")),
|
large_image: Some(String::from("{base_icons_url}/{language}.png")),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use regex::Regex;
|
use regex::{Regex, RegexBuilder};
|
||||||
use serde_json::from_str;
|
use serde_json::from_str;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
@ -29,7 +29,10 @@ pub fn get_language(document: &Document) -> String {
|
||||||
continue;
|
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) {
|
if re.is_match(&filename) || re.is_match(&extension) {
|
||||||
return language.to_string();
|
return language.to_string();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue