@@ -386,40 +386,40 @@ fn generate_tag_name_completions(
386386
387387 // First, check if we should suggest end tags
388388 // If partial starts with "end", prioritize end tags
389- if partial. starts_with ( "end" ) && tag_specs. is_some ( ) {
390- let specs = tag_specs. unwrap ( ) ;
391-
392- // Add all end tags that match the partial
393- for ( opener_name, spec) in specs {
394- if let Some ( end_tag) = & spec. end_tag {
395- if end_tag. name . starts_with ( partial) {
396- // Create a completion for the end tag
397- let mut insert_text = String :: new ( ) ;
398- if needs_space {
399- insert_text. push ( ' ' ) ;
400- }
401- insert_text. push_str ( & end_tag. name ) ;
389+ if partial. starts_with ( "end" ) {
390+ if let Some ( specs) = tag_specs {
391+ // Add all end tags that match the partial
392+ for ( opener_name, spec) in specs {
393+ if let Some ( end_tag) = & spec. end_tag {
394+ if end_tag. name . starts_with ( partial) {
395+ // Create a completion for the end tag
396+ let mut insert_text = String :: new ( ) ;
397+ if needs_space {
398+ insert_text. push ( ' ' ) ;
399+ }
400+ insert_text. push_str ( & end_tag. name ) ;
402401
403- // Add closing based on what's already present
404- match closing {
405- ClosingBrace :: PartialClose | ClosingBrace :: None => {
406- insert_text. push_str ( " %}" ) ;
402+ // Add closing based on what's already present
403+ match closing {
404+ ClosingBrace :: PartialClose | ClosingBrace :: None => {
405+ insert_text. push_str ( " %}" ) ;
406+ }
407+ ClosingBrace :: FullClose => { } // No closing needed
407408 }
408- ClosingBrace :: FullClose => { } // No closing needed
409- }
410409
411- completions. push ( lsp_types:: CompletionItem {
412- label : end_tag. name . to_string ( ) ,
413- kind : Some ( lsp_types:: CompletionItemKind :: KEYWORD ) ,
414- detail : Some ( format ! ( "End tag for {opener_name}" ) ) ,
415- text_edit : Some ( tower_lsp_server:: lsp_types:: CompletionTextEdit :: Edit (
416- lsp_types:: TextEdit :: new ( replacement_range, insert_text. clone ( ) ) ,
417- ) ) ,
418- insert_text_format : Some ( lsp_types:: InsertTextFormat :: PLAIN_TEXT ) ,
419- filter_text : Some ( end_tag. name . to_string ( ) ) ,
420- sort_text : Some ( format ! ( "0_{}" , end_tag. name. as_ref( ) ) ) , // Priority sort
421- ..Default :: default ( )
422- } ) ;
410+ completions. push ( lsp_types:: CompletionItem {
411+ label : end_tag. name . to_string ( ) ,
412+ kind : Some ( lsp_types:: CompletionItemKind :: KEYWORD ) ,
413+ detail : Some ( format ! ( "End tag for {opener_name}" ) ) ,
414+ text_edit : Some ( tower_lsp_server:: lsp_types:: CompletionTextEdit :: Edit (
415+ lsp_types:: TextEdit :: new ( replacement_range, insert_text. clone ( ) ) ,
416+ ) ) ,
417+ insert_text_format : Some ( lsp_types:: InsertTextFormat :: PLAIN_TEXT ) ,
418+ filter_text : Some ( end_tag. name . to_string ( ) ) ,
419+ sort_text : Some ( format ! ( "0_{}" , end_tag. name. as_ref( ) ) ) , // Priority sort
420+ ..Default :: default ( )
421+ } ) ;
422+ }
423423 }
424424 }
425425 }
0 commit comments