LiveScript icon indicating copy to clipboard operation
LiveScript copied to clipboard

Trees not working with tab characters

Open karamfil opened this issue 12 years ago • 6 comments

Hello,

I found that using trees with tabs is throwing an error

unmatched dedent (1 for 2) on line 3

This code compiles perfectly fine with spaces:

table1 =
    *   id: 1
        name: 'george'
    *   id: 2
        name: 'mike'

And when using tabs this code throws an error:

table1 =
    *   id: 1
        name: 'george'
    *   id: 2
        name: 'mike'

karamfil avatar Aug 30 '13 19:08 karamfil

Yeah, you need to indent it even more :(.

vendethiel avatar Sep 14 '13 10:09 vendethiel

The only way I've gotten it to work w/ tabs is like this:

table1 =
    *id: 1
        name: 'george'
    *id: 2
        name: 'mike'

Is this something that could be fixed? Looks like there's an improvement was listed, but is that in the compiler now?

Sawtaytoes avatar Dec 22 '15 07:12 Sawtaytoes

@Saturn2888 I usually do it like this:

table1 =
    do
        id: 1
        name: \george
    do
        id: 2
        name: \mike

And for single item:

table1 =
    do
        id: 1
        name: \george
    ...

unclechu avatar Dec 22 '15 10:12 unclechu

Much better workaround!

Sawtaytoes avatar Dec 22 '15 11:12 Sawtaytoes

Since LiveScript doesn't let you mix tabs and spaces, using tabs strikes me as a pretty bad idea:

table1 =
\t*\ta: b    # 3 characters
\t\tb: c      # 2 characters
\t\t\tc: d    # 3 characters

# Which looks like:

table1 =
    *   a: b        # 3 characters
        b: c        # 2 characters (this is an error)
            c: d    # 3 characters

robotlolita avatar Dec 22 '15 11:12 robotlolita

We should probably change star support from being a hack to being an actual thing, but...

vendethiel avatar Dec 22 '15 12:12 vendethiel