@@ -2,7 +2,9 @@ use lsp_types::{Position, Range, Url};
22use serde:: { Deserialize , Serialize } ;
33
44use crate :: {
5- context:: FileLang , utils:: { location_to_lsp_range, lsp_range_to_location} , ServerContext
5+ context:: FileLang ,
6+ utils:: { location_to_lsp_range, lsp_range_to_location} ,
7+ ServerContext ,
68} ;
79
810#[ derive( Debug , Clone , Deserialize ) ]
@@ -22,9 +24,7 @@ pub(crate) async fn tmpl_converted_expr_release(
2224 move |project, abs_path, file_lang| -> anyhow:: Result < bool > {
2325 let success = if let Some ( _) = project. cached_file_content ( & abs_path) {
2426 match file_lang {
25- FileLang :: Wxml => {
26- project. wxml_converted_expr_release ( & abs_path)
27- }
27+ FileLang :: Wxml => project. wxml_converted_expr_release ( & abs_path) ,
2828 _ => false ,
2929 }
3030 } else {
@@ -62,7 +62,8 @@ pub(crate) async fn tmpl_converted_expr_code(
6262 let code = if let Some ( _) = project. cached_file_content ( & abs_path) {
6363 match file_lang {
6464 FileLang :: Wxml => {
65- let code = project. wxml_converted_expr_code ( & abs_path, & params. ts_env ) ?;
65+ let code =
66+ project. wxml_converted_expr_code ( & abs_path, & params. ts_env ) ?;
6667 Some ( TmplConvertedExprCode { code } )
6768 }
6869 _ => None ,
@@ -98,7 +99,10 @@ pub(crate) async fn tmpl_converted_expr_get_source_location(
9899 . clone ( )
99100 . project_thread_task (
100101 & params. text_document_uri ,
101- move |project, abs_path, file_lang| -> anyhow:: Result < Option < TmplConvertedExprGetSourceLocation > > {
102+ move |project,
103+ abs_path,
104+ file_lang|
105+ -> anyhow:: Result < Option < TmplConvertedExprGetSourceLocation > > {
102106 let src_loc = if let Some ( _) = project. cached_file_content ( & abs_path) {
103107 match file_lang {
104108 FileLang :: Wxml => {
@@ -129,7 +133,7 @@ pub(crate) struct TmplConvertedExprGetTokenAtSourcePositionParams {
129133#[ serde( rename_all = "camelCase" ) ]
130134pub ( crate ) struct TmplConvertedExprGetTokenAtSourcePosition {
131135 src : Range ,
132- dest : Position
136+ dest : Position ,
133137}
134138
135139pub ( crate ) async fn tmpl_converted_expr_get_token_at_source_position (
@@ -140,23 +144,30 @@ pub(crate) async fn tmpl_converted_expr_get_token_at_source_position(
140144 . clone ( )
141145 . project_thread_task (
142146 & params. text_document_uri ,
143- move |project, abs_path, file_lang| -> anyhow:: Result < Option < TmplConvertedExprGetTokenAtSourcePosition > > {
147+ move |project,
148+ abs_path,
149+ file_lang|
150+ -> anyhow:: Result < Option < TmplConvertedExprGetTokenAtSourcePosition > > {
144151 let ret = if let Some ( _) = project. cached_file_content ( & abs_path) {
145152 match file_lang {
146153 FileLang :: Wxml => {
147- let pos = crate :: wxss:: Position { line : params. pos . line , utf16_col : params. pos . character } ;
154+ let pos = crate :: wxss:: Position {
155+ line : params. pos . line ,
156+ utf16_col : params. pos . character ,
157+ } ;
148158 project. wxml_converted_expr_get_token_at_source_position ( & abs_path, pos)
149159 }
150160 _ => None ,
151161 }
152162 } else {
153163 None
154164 } ;
155- let ret = ret. map ( |( src, dest) | {
156- TmplConvertedExprGetTokenAtSourcePosition {
157- src : location_to_lsp_range ( & src) ,
158- dest : Position { line : dest. line , character : dest. utf16_col } ,
159- }
165+ let ret = ret. map ( |( src, dest) | TmplConvertedExprGetTokenAtSourcePosition {
166+ src : location_to_lsp_range ( & src) ,
167+ dest : Position {
168+ line : dest. line ,
169+ character : dest. utf16_col ,
170+ } ,
160171 } ) ;
161172 Ok ( ret)
162173 } ,
0 commit comments