@@ -711,61 +711,6 @@ fn recurse_parenthesized_expression(
711
711
( ) . ok ( )
712
712
}
713
713
714
- // TODO: This should be a syntax check, as the grammar should not allow
715
- // two `Argument` nodes side by side
716
- fn check_call_like_next_sibling (
717
- child : Node ,
718
- parent_type : & NodeType ,
719
- context : & mut DiagnosticContext ,
720
- diagnostics : & mut Vec < Diagnostic > ,
721
- ) -> Result < ( ) > {
722
- let Some ( next) = child. next_sibling ( ) else {
723
- return ( ) . ok ( ) ;
724
- } ;
725
-
726
- let close = match parent_type {
727
- NodeType :: Call => ")" ,
728
- NodeType :: Subset => "]" ,
729
- NodeType :: Subset2 => "]]" ,
730
- _ => bail ! ( "Parent must be a call, subset, or subset2 node." ) ,
731
- } ;
732
-
733
- let ok = match next. node_type ( ) {
734
- NodeType :: Comma => true ,
735
- NodeType :: Anonymous ( kind) if kind. as_str ( ) == close => true ,
736
- NodeType :: Comment => true ,
737
- // Should be handled elsewhere
738
- NodeType :: Error => true ,
739
- _ => false ,
740
- } ;
741
-
742
- if ok {
743
- return ( ) . ok ( ) ;
744
- }
745
-
746
- // Children can be arbitrarily large, so report the issue between the end of `child`
747
- // and the start of `next` (it's not really the child's fault anyways,
748
- // it's the fault of the thing right after it).
749
- let start_byte = child. end_byte ( ) ;
750
- let start_point = child. end_position ( ) ;
751
- let end_byte = next. start_byte ( ) ;
752
- let end_point = next. start_position ( ) ;
753
-
754
- let range = Range {
755
- start_byte,
756
- start_point,
757
- end_byte,
758
- end_point,
759
- } ;
760
-
761
- let range = convert_tree_sitter_range_to_lsp_range ( context. contents , range) ;
762
- let message = "Expected ',' between expressions." ;
763
- let diagnostic = Diagnostic :: new_simple ( range, message. into ( ) ) ;
764
- diagnostics. push ( diagnostic) ;
765
-
766
- ( ) . ok ( )
767
- }
768
-
769
714
/// Default recursion for arguments of a call-like node
770
715
///
771
716
/// This applies for function calls, subset, and subset2, all of which are guaranteed
@@ -792,8 +737,6 @@ fn recurse_call_like_arguments_default(
792
737
// every function behaves like `list()`, which is our default model of
793
738
// strict evaluation.
794
739
with_in_call_like_arguments ( context, |context| {
795
- let call_type = node. node_type ( ) ;
796
-
797
740
let Some ( arguments) = node. child_by_field_name ( "arguments" ) else {
798
741
return Ok ( ( ) ) ;
799
742
} ;
@@ -803,9 +746,6 @@ fn recurse_call_like_arguments_default(
803
746
let children = arguments. children_by_field_name ( "argument" , & mut cursor) ;
804
747
805
748
for child in children {
806
- // Warn if the next sibling is neither a comma nor the correct closing delimiter
807
- check_call_like_next_sibling ( child, & call_type, context, diagnostics) ?;
808
-
809
749
// Recurse into `value`s
810
750
if let Some ( value) = child. child_by_field_name ( "value" ) {
811
751
recurse ( value, context, diagnostics) ?;
@@ -1111,23 +1051,6 @@ foo
1111
1051
} )
1112
1052
}
1113
1053
1114
- #[ test]
1115
- fn test_expression_after_call_argument ( ) {
1116
- r_task ( || {
1117
- let text = "match(1, 2 3)" ;
1118
- let document = Document :: new ( text, None ) ;
1119
-
1120
- let diagnostics = generate_diagnostics ( document, DEFAULT_STATE . clone ( ) ) ;
1121
- assert_eq ! ( diagnostics. len( ) , 1 ) ;
1122
-
1123
- // Diagnostic highlights between the `2` and `3`
1124
- let diagnostic = diagnostics. get ( 0 ) . unwrap ( ) ;
1125
- insta:: assert_snapshot!( diagnostic. message) ;
1126
- assert_eq ! ( diagnostic. range. start, Position :: new( 0 , 10 ) ) ;
1127
- assert_eq ! ( diagnostic. range. end, Position :: new( 0 , 11 ) ) ;
1128
- } )
1129
- }
1130
-
1131
1054
#[ test]
1132
1055
fn test_no_diagnostic_for_dot_dot_i ( ) {
1133
1056
r_task ( || {
0 commit comments