zephir-lang / zephir-atom

Zephir syntax highlighter for Atom
10 stars 2 forks source link

Curly brackets sometimes remove one level of indentation #2

Open Siguza opened 9 years ago

Siguza commented 9 years ago

Curly brackets ({ and }) tend to mess up indentation when pasted or typed in a zephir file.

For these examples, all code can be pasted inside an empty class to provide one level of indentation.

class Test
{
    // here
}

In the following snippets, the curly brackets and the code in between gets a wrong indentation level:

Pasted code:

function abc()
{
}

Result:

class Test
{
    function abc()
{
}
}

Pasted code:

if a == b
{
}

Result:

class Test
{
    if a == b
{
}
}

Pasted code:

loop
{
}

Result:

class Test
{
    loop
{
}
}

However, if brackets are used in an if construct, the indentation level is as expected:

Pasted code:

if(a == b)
{
}

Result:

class Test
{
    if(a == b)
    {
    }
}