Skip to content

Commit d782088

Browse files
committed
fmt: cargo
1 parent 108a632 commit d782088

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

src/context/project.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ impl Project {
168168
} else {
169169
Default::default()
170170
};
171-
ret.lock().await.push(Project::new(p, app_json_config, options));
171+
ret.lock()
172+
.await
173+
.push(Project::new(p, app_json_config, options));
172174
return Ok(());
173175
}
174176
let dir = tokio_stream::wrappers::ReadDirStream::new(tokio::fs::read_dir(p).await?);
@@ -194,7 +196,11 @@ impl Project {
194196
ret
195197
}
196198

197-
pub(crate) fn new(root: &Path, app_json_config: JsonConfig, options: &ServerContextOptions) -> Self {
199+
pub(crate) fn new(
200+
root: &Path,
201+
app_json_config: JsonConfig,
202+
options: &ServerContextOptions,
203+
) -> Self {
198204
Self {
199205
root: Some(root.to_path_buf()),
200206
file_contents: HashMap::new(),
@@ -216,7 +222,9 @@ impl Project {
216222
}
217223

218224
fn is_app_path(&self, abs_path: &Path) -> bool {
219-
self.root().filter(|root| root.join("app.json") == abs_path.with_extension("json")).is_some()
225+
self.root()
226+
.filter(|root| root.join("app.json") == abs_path.with_extension("json"))
227+
.is_some()
220228
}
221229

222230
fn unix_rel_path_or_fallback(&self, abs_path: &Path) -> String {
@@ -370,7 +378,10 @@ impl Project {
370378
self.file_contents.get(abs_path)
371379
}
372380

373-
pub(crate) fn cached_file_content_if_opened(&self, abs_path: &Path) -> Option<&FileContentMetadata> {
381+
pub(crate) fn cached_file_content_if_opened(
382+
&self,
383+
abs_path: &Path,
384+
) -> Option<&FileContentMetadata> {
374385
let content = self.file_contents.get(abs_path);
375386
content.filter(|x| x.opened)
376387
}
@@ -643,7 +654,10 @@ impl Project {
643654
pub(crate) fn iter_using_components_keys(&self, abs_path: &Path) -> impl Iterator<Item = &str> {
644655
let json_path = abs_path.with_extension("json");
645656
let app_using = self.app_json_config.using_components.keys();
646-
let self_using = self.get_json_config(&json_path).map(|x| x.using_components.keys()).unwrap_or_default();
657+
let self_using = self
658+
.get_json_config(&json_path)
659+
.map(|x| x.using_components.keys())
660+
.unwrap_or_default();
647661
self_using.chain(app_using).map(|x| x.as_str())
648662
}
649663

@@ -690,7 +704,10 @@ impl Project {
690704
self.for_each_json_config(|p, json_config| {
691705
let source_wxml = p.with_extension("wxml");
692706
for global_expected_tag_name in global_expected_tag_names.iter() {
693-
if json_config.using_components.contains_key(global_expected_tag_name) {
707+
if json_config
708+
.using_components
709+
.contains_key(global_expected_tag_name)
710+
{
694711
continue;
695712
}
696713
if let Ok(template) = self.get_wxml_tree(&source_wxml) {

src/file.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ pub(crate) async fn request_diagnostics(
187187
params: RequestDiagnosticsParams,
188188
) -> anyhow::Result<bool> {
189189
let uri = params.text_document_uri.clone();
190-
ctx
191-
.clone()
190+
ctx.clone()
192191
.project_thread_task(
193192
&params.text_document_uri,
194193
move |project, abs_path, file_lang| {

0 commit comments

Comments
 (0)