Sublime Forum

[Solved] Weird JSON indent, v3114

#1

Hello!

That’s my first post on the forum :slight_smile: But you gonna hear from me soon!

I digress though. Let’s imagine such a silly .json file

1. {"foo": [12, 34]}|
2.

Ok. Now press enter.

1. {"foo": [12, 34]}
2.    |
3.

Why is the new line indented more than previous? How to prevent it? I hope nobody suggests turning off auto indentation! :wink:

All plugins are listed in “ignored_packages”, otherwise default settings and key bindings. Sublime version 3114.

1 Like

#2

Looks like it is due to the regex that defines the indentation pattern:

^.*\[
     (
        (.*(?!\],|.\])\S{2})
     )?
\s*$

looks pretty dodgy to me with no comments to explain it :wink: maybe someone can propose something better?..

1 Like

#3

Will has just done an awesome job of improving the rules in this file, so this will be fixed in the next build - thanks @wbond, nice work! Super easy to follow now :slightly_smiling:

1 Like