ecomfe / jformatter

A JavaScript formatter
BSD 2-Clause "Simplified" License
3 stars 0 forks source link

problem indenting rows containing multiple and not requested '\t' tabs #3

Closed bitliner closed 9 years ago

bitliner commented 9 years ago

My initial code is the following:

function(){
\t\t\tconsole.log('ciao');
}

If I format it using default options it still remains the same (3 tabs).

The expected behavior would be to reduce the number of tabs at line 2 from 3 tabs to only one (at least so common formatters work).

ishowshao commented 9 years ago

thank you, i will check and fix

在 2015年5月17日,00:15,Giovanni Gaglione notifications@github.com 写道:

My initial code is the following:

function(){ \t\t\tconsole.log('ciao'); } If I format it with default options it still remains the same.

The expected behavior would be to reduce the number of tags at line 2 to only one tab (at least so common formatters work).

— Reply to this email directly or view it on GitHub.

ishowshao commented 9 years ago

hi, this is not jformatter's bug.

your code have a syntax error

function(){
\t\t\tconsole.log('ciao');
}

function declaration mast have a function name, your code have to change to

function funcName(){
\t\t\tconsole.log('ciao');
}

esprima fail on syntax error code, so code will not be formatted

ishowshao commented 9 years ago

anyway, thank you for the first issue for me