fix: allow creating underindented scope

pull/625/head^2
Nikolaj Sidorenco 2024-04-20 14:20:46 +07:00
parent bd3391c60f
commit 006922183e
No known key found for this signature in database
3 changed files with 79 additions and 8 deletions

@ -1,5 +1,5 @@
do let x =
match x with (
| x -> () 1
| _ -> () 2
if x then () else () )

@ -209,9 +209,8 @@ bool tree_sitter_fsharp_external_scanner_scan(void *payload, TSLexer *lexer,
return true; return true;
} }
if (valid_symbols[INDENT] && indent_length > current_indent_length && if (valid_symbols[INDENT] && !found_start_of_infix_op &&
!found_start_of_infix_op && !found_bracket_end && !found_bracket_end && !error_recovery_mode) {
!error_recovery_mode) {
array_push(&scanner->indents, indent_length); array_push(&scanner->indents, indent_length);
lexer->result_symbol = INDENT; lexer->result_symbol = INDENT;
return true; return true;

@ -173,6 +173,24 @@ do (4)
(paren_expression (paren_expression
(const (int)))))) (const (int))))))
================================================================================
sequential expression in paren expression
================================================================================
do
(4
3)
--------------------------------------------------------------------------------
(file
(value_declaration
(do
(paren_expression
(sequential_expression
(const (int))
(const (int)))))))
================================================================================ ================================================================================
let decl in paren expression let decl in paren expression
================================================================================ ================================================================================
@ -1912,3 +1930,57 @@ do
(unit)) (unit))
(const (const
(unit))))))) (unit)))))))
================================================================================
multi-line Array.map
================================================================================
let f xs =
xs
|> Array.map (fun x ->
let y = x + 1
x)
--------------------------------------------------------------------------------
(file
(value_declaration
(function_or_value_defn
(function_declaration_left
(identifier)
(argument_patterns
(long_identifier
(identifier))))
(application_expression
(infix_expression
(long_identifier_or_op
(long_identifier
(identifier)))
(infix_op
(symbolic_op))
(long_identifier_or_op
(long_identifier
(identifier)
(identifier))))
(paren_expression
(fun_expression
(argument_patterns
(long_identifier
(identifier)))
(declaration_expression
(function_or_value_defn
(value_declaration_left
(identifier_pattern
(long_identifier
(identifier))))
(infix_expression
(long_identifier_or_op
(long_identifier
(identifier)))
(infix_op)
(const
(int))))
(long_identifier_or_op
(long_identifier
(identifier))))))))))