OyvindSabo / gremlint

Linter/Code formatter for Gremlin
https://gremlint.com
Apache License 2.0
11 stars 6 forks source link

Preserve relative indentation between all lines in a closure when specifying custom indentation #72

Closed OyvindSabo closed 3 years ago

OyvindSabo commented 3 years ago

Consider that we want to format the following query with a max line length of 70:

g.V().
has('sell_price').
has('buy_price').
project('product', 'profit').
by('name').
by{ it.get().value('sell_price') -
    it.get().value('buy_price') };

With an indentation of 0 spaces it is formatted like this (as expected):

g.V().
  has('sell_price').
  has('buy_price').
  project('product', 'profit').
    by('name').
    by{ it.get().value('sell_price') -
        it.get().value('buy_price') };

However, with an indentation of 20 spaces it is formatted like this:

                    g.V().
                      has('sell_price').
                      has('buy_price').
                      project('product', 'profit').
                        by('name').
                        by{ it.get().value('sell_price') -
        it.get().value('buy_price') };

I would expect it to be formatted like this:

                    g.V().
                      has('sell_price').
                      has('buy_price').
                      project('product', 'profit').
                        by('name').
                        by{ it.get().value('sell_price') -
                            it.get().value('buy_price') };