Skip to content

Commit c036baa

Browse files
chore: format codebase
1 parent 715d8e9 commit c036baa

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed

crates/intl-lens/src/backend.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::sync::Arc;
33

44
use tokio::sync::RwLock;
55

6-
use tower_lsp::lsp_types::*;
76
use tower_lsp::jsonrpc::Result;
7+
use tower_lsp::lsp_types::*;
88
use tower_lsp::{Client, LanguageServer};
99

1010
use crate::config::I18nConfig;
@@ -79,15 +79,10 @@ impl I18nBackend {
7979
}
8080

8181
async fn register_inlay_hint_capability(&self) {
82-
let supports_dynamic = *self
83-
.inlay_hint_dynamic_registration_supported
84-
.read()
85-
.await;
82+
let supports_dynamic = *self.inlay_hint_dynamic_registration_supported.read().await;
8683

8784
if !supports_dynamic {
88-
tracing::debug!(
89-
"Skipping inlay hint dynamic registration (dynamicRegistration=false)"
90-
);
85+
tracing::debug!("Skipping inlay hint dynamic registration (dynamicRegistration=false)");
9186
return;
9287
}
9388

@@ -166,10 +161,7 @@ impl I18nBackend {
166161

167162
match self.client.register_capability(vec![registration]).await {
168163
Ok(_) => tracing::info!("Registered inlay hint capability dynamically"),
169-
Err(err) => tracing::warn!(
170-
"Dynamic inlay hint registration failed: {:?}",
171-
err
172-
),
164+
Err(err) => tracing::warn!("Dynamic inlay hint registration failed: {:?}", err),
173165
}
174166
}
175167

crates/intl-lens/src/config.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ impl I18nConfig {
6161
.as_ref()
6262
.and_then(|value| value.as_object())
6363
.is_some_and(|object| {
64-
object.contains_key("localePaths") || object.contains_key("locale_paths")
64+
object.contains_key("localePaths")
65+
|| object.contains_key("locale_paths")
6566
});
6667

6768
if !has_locale_paths {
@@ -122,7 +123,8 @@ fn default_function_patterns() -> Vec<String> {
122123
r#"\$t\s*\(\s*["']([^"']+)["']"#.to_string(),
123124
r#"formatMessage\s*\(\s*\{\s*id:\s*["']([^"']+)["']"#.to_string(),
124125
r#"translate(?:Service)?\.(?:instant|get|stream)\s*\(\s*["']([^"']+)["']"#.to_string(),
125-
r#"transloco(?:Service)?\.(?:translate|selectTranslate)\s*\(\s*["']([^"']+)["']"#.to_string(),
126+
r#"transloco(?:Service)?\.(?:translate|selectTranslate)\s*\(\s*["']([^"']+)["']"#
127+
.to_string(),
126128
r#"["']([^"']+)["']\s*\|\s*(?:translate|transloco)\b"#.to_string(),
127129
r#"__\s*\(\s*["']([^"']+)["']"#.to_string(),
128130
r#"trans(?:_choice)?\s*\(\s*["']([^"']+)["']"#.to_string(),
@@ -156,8 +158,11 @@ fn is_angular_project(root: &Path) -> bool {
156158
return false;
157159
};
158160

159-
json_has_dependency(&value, "@angular/core", &["dependencies", "devDependencies"])
160-
|| json_has_dependency(&value, "@angular/cli", &["dependencies", "devDependencies"])
161+
json_has_dependency(
162+
&value,
163+
"@angular/core",
164+
&["dependencies", "devDependencies"],
165+
) || json_has_dependency(&value, "@angular/cli", &["dependencies", "devDependencies"])
161166
}
162167

163168
fn is_laravel_project(root: &Path) -> bool {

crates/intl-lens/src/i18n/store.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ impl TranslationStore {
9090
let mut locale_map = self.translations.entry(locale.to_string()).or_default();
9191
let extension = path.extension().and_then(|e| e.to_str()).unwrap_or("");
9292
let file_stem = path.file_stem().and_then(|s| s.to_str()).unwrap_or("");
93-
let prefix = if extension == "php" && !file_stem.is_empty() && !is_locale_code(file_stem)
94-
{
95-
Some(file_stem)
96-
} else {
97-
None
98-
};
93+
let prefix =
94+
if extension == "php" && !file_stem.is_empty() && !is_locale_code(file_stem) {
95+
Some(file_stem)
96+
} else {
97+
None
98+
};
9999

100100
for (key, value) in translations {
101101
let full_key = match prefix {
@@ -208,7 +208,6 @@ impl TranslationStore {
208208
})
209209
.collect()
210210
}
211-
212211
}
213212

214213
fn is_locale_code(s: &str) -> bool {

0 commit comments

Comments
 (0)