@@ -14,7 +14,8 @@ use lsp_types::{
1414use crate :: {
1515 context:: {
1616 backend_configuration:: MediaFeatureType ,
17- project:: { FileContentMetadata , Project } , FileLang ,
17+ project:: { FileContentMetadata , Project } ,
18+ FileLang ,
1819 } ,
1920 wxml_utils:: {
2021 for_each_static_class_name_in_element, for_each_template_element, Token as WxmlToken ,
@@ -317,11 +318,11 @@ fn completion_wxml(
317318 } else {
318319 let choices = item_set
319320 . into_iter ( )
320- . filter ( |x| {
321- match class {
322- ClassAttribute :: Multiple ( arr) => arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( ) ,
323- _ => true ,
321+ . filter ( |x| match class {
322+ ClassAttribute :: Multiple ( arr) => {
323+ arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( )
324324 }
325+ _ => true ,
325326 } )
326327 . join ( "," ) ;
327328 if let ClassAttribute :: None = class {
@@ -354,11 +355,11 @@ fn completion_wxml(
354355 . style_property
355356 . iter ( )
356357 . map ( |x| & x. name )
357- . filter ( |x| {
358- match style {
359- StyleAttribute :: Multiple ( arr) => arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( ) ,
360- _ => true ,
358+ . filter ( |x| match style {
359+ StyleAttribute :: Multiple ( arr) => {
360+ arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( )
361361 }
362+ _ => true ,
362363 } )
363364 . join ( "," ) ;
364365 items. push ( snippet_completion_item (
@@ -672,56 +673,46 @@ fn completion_wxml(
672673 WxmlToken :: ModelAttributeName ( _attr_name, elem) => handle_attr ( elem, true ) ,
673674 WxmlToken :: ChangeAttributeName ( _attr_name, elem) => handle_attr ( elem, true ) ,
674675 WxmlToken :: AttributeKeyword ( _loc, elem) => handle_attr ( elem, false ) ,
675- WxmlToken :: StaticClassName ( _loc, _name, elem) => {
676- match & elem. kind {
677- ElementKind :: Normal { class, .. } => {
678- let items = collect_classes_in_wxss ( project, abs_path)
679- . into_iter ( )
680- . filter ( |x| {
681- match class {
682- ClassAttribute :: Multiple ( arr) => arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( ) ,
683- _ => true ,
684- }
685- } )
686- . map ( |x| {
687- simple_completion_item (
688- x,
689- CompletionItemKind :: PROPERTY ,
690- false ,
691- )
692- } )
693- . collect ( ) ;
694- Some ( CompletionList { is_incomplete : false , items } )
695- }
696- _ => None ,
676+ WxmlToken :: StaticClassName ( _loc, _name, elem) => match & elem. kind {
677+ ElementKind :: Normal { class, .. } => {
678+ let items = collect_classes_in_wxss ( project, abs_path)
679+ . into_iter ( )
680+ . filter ( |x| match class {
681+ ClassAttribute :: Multiple ( arr) => {
682+ arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( )
683+ }
684+ _ => true ,
685+ } )
686+ . map ( |x| simple_completion_item ( x, CompletionItemKind :: PROPERTY , false ) )
687+ . collect ( ) ;
688+ Some ( CompletionList {
689+ is_incomplete : false ,
690+ items,
691+ } )
697692 }
698- }
699- WxmlToken :: StaticStylePropertyName ( _, elem) => {
700- match & elem. kind {
701- ElementKind :: Normal { style, .. } => {
702- let items = backend_config
703- . style_property
704- . iter ( )
705- . map ( |x| & x. name )
706- . filter ( |x| {
707- match style {
708- StyleAttribute :: Multiple ( arr) => arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( ) ,
709- _ => true ,
710- }
711- } )
712- . map ( |x| {
713- simple_completion_item (
714- x,
715- CompletionItemKind :: PROPERTY ,
716- false ,
717- )
718- } )
719- . collect ( ) ;
720- Some ( CompletionList { is_incomplete : false , items } )
721- }
722- _ => None ,
693+ _ => None ,
694+ } ,
695+ WxmlToken :: StaticStylePropertyName ( _, elem) => match & elem. kind {
696+ ElementKind :: Normal { style, .. } => {
697+ let items = backend_config
698+ . style_property
699+ . iter ( )
700+ . map ( |x| & x. name )
701+ . filter ( |x| match style {
702+ StyleAttribute :: Multiple ( arr) => {
703+ arr. iter ( ) . find ( |y| y. 1 . name == x) . is_none ( )
704+ }
705+ _ => true ,
706+ } )
707+ . map ( |x| simple_completion_item ( x, CompletionItemKind :: PROPERTY , false ) )
708+ . collect ( ) ;
709+ Some ( CompletionList {
710+ is_incomplete : false ,
711+ items,
712+ } )
723713 }
724- }
714+ _ => None ,
715+ } ,
725716 WxmlToken :: EventName ( _event_name, elem) => {
726717 let mut items: Vec < CompletionItem > = vec ! [ ] ;
727718 let has_event = |common : & CommonElementAttributes , name : & str | {
0 commit comments