0
Under review

Indent Based on Syntax: '(' and '[' do not auto-indent

Jimmy Luo @ jimm[dot]my 5 months ago in iPhone updated 5 months ago 7

Which syntax definition or type of file are you using?

I apologize, I accidentally submitted the bug without the details. I'm trying to edit it now. I will ping here once updated. If unable to update, I will reply to you here with the bug content. 

Thanks a lot for the details. I’ll look into it. 

Ugh sorry. Now I accidentally put the details in an L1 reply instead of replying to your question here. I'm writing all this on iPhone, and User Echo does not provide as good an experience as Textastic 😅

Note: Possible regression, unsure. It's also possible that this was always the behavior, and I am not strongly opinionated whether or not this is the desired behavior.


Repro:

  1. Launch Textastic
  2. Go to Settings ⏵ Code Editor ⏵ Text Editing
  3. Enable all controls:
    1. Code Completion
    2. Indent Based on Syntax
    3. Close Brackets and Quotes
  4. Open .js or .ts file with Properties ⏵ Text Properties ⏵ Syntax Definition ⏵ JavaScript (*.js, *.htc) or TypeScript (*.ts)
  5. Type '{' or '[' or '('
  6. Textastic auto-closes the bracket pair with '}' or ']' or ')', with cursor between the matching pair
  7. Input "Enter" on the keyboard


    Expected:

    Bracket pair is split into three lines:

    1. Line 1: opening bracket
    2. Line 2: cursor with 1 level deeper indentation
    3. Line 3: closing bracket

    {
    ⏵⏵|
    }


    Actual:
    The expected behavior occurs for curly braces '{'.

    However, for square brackets '[' or parens '(', the bracket pair is split into two lines:


    1. Line 1: opening bracket
    2. Line 2: closing bracket with same indentation as Line 1, cursor to the left of closing bracket

    [
    |]



    Device info:
    App version: 10.3.2
    iOS version: 17.5.1
    Device: iPhone 15 Pro Max