File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1- use rstml:: node:: NodeElement ;
1+ use rstml:: node:: { NodeElement , NodeName } ;
22
33///
44/// Converts `syn::Block` to simple expression
@@ -42,10 +42,24 @@ pub fn value_to_string(value: &syn::Expr) -> Option<String> {
4242 }
4343}
4444
45- pub fn is_component_tag_name ( name : & str ) -> bool {
46- name. starts_with ( |c : char | c. is_ascii_uppercase ( ) )
45+ pub fn is_component_tag_name ( name : & NodeName ) -> bool {
46+ match name {
47+ NodeName :: Path ( path) => {
48+ !path. path . segments . is_empty ( )
49+ && path
50+ . path
51+ . segments
52+ . last ( )
53+ . unwrap ( )
54+ . ident
55+ . to_string ( )
56+ . starts_with ( |c : char | c. is_ascii_uppercase ( ) )
57+ }
58+ NodeName :: Block ( _) => false ,
59+ NodeName :: Punctuated ( _) => false ,
60+ }
4761}
4862
4963pub fn is_component_node ( node : & NodeElement ) -> bool {
50- is_component_tag_name ( & node. name ( ) . to_string ( ) )
64+ is_component_tag_name ( node. name ( ) )
5165}
Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ impl IdeTagHelper {
2424 /// Save stmts for tag name.
2525 /// Emit warning if tag is component.
2626 pub fn save_tag_completion ( & mut self , name : & NodeName ) {
27- let tag_name = name. to_string ( ) ;
28- if is_component_tag_name ( & tag_name) {
27+ if is_component_tag_name ( name) {
2928 proc_macro_error:: emit_warning!(
3029 name. span( ) ,
3130 "BUG: Component tag is used in regular tag completion."
You can’t perform that action at this time.
0 commit comments