Issues with indentation


#1

Hey mates,

Since yesterday night, I have a weird issue on indentation.
In fact, the automatic indentation seems to be borken as you can see on this GIF : https://i.gyazo.com/a94635868e431494582a5e86f8e1e743.gif

I wanted to have the emacs’s like indentation but I didn’t find packages which were working and could have probably fixed my issue.

Do you guys have any ideas ?

Thanks in advance.
Regards.


#2

What grammar do you have active in the example?


#3

Hey,

Thanks for the answer.

Are you talking about this : https://i.gyazo.com/c51f318a96afc7a1f1e24401d3584962.png


#4

Yes. The indentation rules are in the associated language package, which does not have an allowance for the sort of thing you’re doing. You could fork or wrap it and add ^if\s?\(.+\) or something similar to increase the indent pattern, but you might have to manually delete the indentation when you want to get out of that, because the matcher isn’t smart enough to determine when you’re leaving an if statement that only has one line inside it. A package would be able to look further and be smart about that.


#5

Hi,

Well the fact is that it was working somedays ago. I was using emacs’s like indent with https://atom.io/packages/emacs-flow and it was working properly until fex days.

The owner warned about this package been considered deprecated but it was still working so, I really don’t understand.

Another interesting point is that the auto indent is done on my case if the ‘if’ isn’t in a while loop.


#6

Did Atom update recently?

Another interesting point is that the auto indent is done on my case if the ‘if’ isn’t in a while loop.

That’s important. What other circumstances enable the auto-indent to work correctly?

Also important is the fact that you have a package that you knew about and didn’t mention.


#7

Well, an update has been done the 15th but it doesn’t look like to be the
original of my issue.

It looks like the only one.


#8

Well, it seems like a package issue. I don’t know what emacs-like indentation is and the package doesn’t say, so unless you can describe it, I can’t tell you how to emulate it.


#9

No problem, I’ll continue to look for something to resolve this issue.
Thanks for your help dude !


#10

No problem. :slight_smile:

Maybe something with snippets could simplify your life enough that the indentation isn’t an issue. If you want to pursue an init.coffee function to make indentation behave the way you want it to, I could point you in the right direction.