language-typescript icon indicating copy to clipboard operation
language-typescript copied to clipboard

Incorrect indentation when using flow and tree-sitter

Open IanVS opened this issue 7 years ago • 1 comments

Prerequisites

  • [X] Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
    • Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
    • Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
    • Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

Description

I originally opened this in https://github.com/atom/language-javascript/issues/603. Duplicating here, since this seems to be the grammar being used.

When using the Flow Javascript grammar with tree-sitter enabled, I notice that parenthesis are not always outdented correctly, whereas they are when using Javascript. Here are some examples (taken during safe mode):

Javascript (correct)

javascript

Flow Javascript (incorrect)

flow

Steps to Reproduce

  1. Create a file with the flow pragma
  2. Verify the grammar shows as Flow Javascript
  3. Notice that indentation is wonky, as shown in the gif above.

Expected behavior: [What you expect to happen] I expect the closing parenthesis to be on the same column as the first character of the line with the opening parenthesis.

Actual behavior: [What actually happens] The closing parens is indented by one level, to the same position as the cursor.

Reproduces how often: [What percentage of the time does it reproduce?] 100%

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

Atom : 1.32.0-beta3 Electron: 2.0.9 Chrome : 61.0.3163.100 Node : 8.9.3 apm 2.1.2 npm 6.2.0 node 8.9.3 x64 atom 1.32.0-beta3 python 2.7.10 git 2.19.1

IanVS avatar Oct 10 '18 20:10 IanVS

Also, I have to say, it's more than a little confusing that the language-typescript grammar is used to handle flow.

IanVS avatar Oct 10 '18 20:10 IanVS