Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Anything with "fi" gets unindented, even if not scoped inside of an "if" #101

Open
1 task done
envygeeks opened this issue Feb 5, 2018 · 5 comments
Open
1 task done

Comments

@envygeeks
Copy link

envygeeks commented Feb 5, 2018

Prerequisites

Description

When typing anything with "fi" inside of Atom editor, with the Shellscript language enabled, it gets unindented to the next level. Which forces you to have to go to the beginning of the line and properly indent it.

Steps to Reproduce

  1. Open a file
  2. Set syntax to shellscript
  3. Press Tab
  4. Type fi

Expected behavior:

It not to unindent until a space happens... and only if within the context of an if. At minimum though I would expect it to wait until I finish typing and press space, because the find command is quite common in any shell script, this gets in the way quite a bit when working with scripts.

@50Wliu
Copy link
Contributor

50Wliu commented Feb 5, 2018

and only if within the context of an if

This part should be fixed if you start using the new tree-sitter grammar included with language-shellscript.

not to unindent until a space happens

Is it common to have a space character after a fi? It seems to me like fis are usually at the end of the line, like so:

if [ -f /some/file ]; then
    echo "/some/file exists."
fi

@envygeeks
Copy link
Author

Is it common to have a space character after a fi?

It's not common to have a space (I was just waking up and hadn't had coffee yet sorry about that crazy nonsensical comment.) 😂 the space was me thinking "wait till I hit space for 'find' before doing it" but that doesn't make sense really.

@envygeeks
Copy link
Author

Is there a guide or something that shows how to use "tree-sitter"? It seems that searching in packages doesn't help, or must I build, or use a specific version of Atom or...?

@50Wliu
Copy link
Contributor

50Wliu commented Feb 5, 2018

I think it'll be shipping in Atom 1.25.0 beta, and there will be a setting for you to turn on in Settings -> Core (Use Tree Sitter Parsers).

@envygeeks
Copy link
Author

Just updating to say that treesitter didn't fix this, when in the context of an if, when I start to type "fi" for "find" it unindents.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants