Sublime Forum

Indentation fails after comment block

#1

Sublime text 2 v2.0.1 build 2217

I’ve noticed that the indentation behavior (reindent function aswell) fails after comment block (at least for PHP syntax).
Right after a comment block which contains brackets, the indentation use the tabs count of the last bracket in the comment block instead of totally ignoring it.

Examples using the reindent function and moving the last bracket of test2 :

function test() {
}
	/*
	function test2() {
			}
	*/
			function test3() {
			}
?>
function test() {
}
	/*
	function test2() {
	}
	*/
	function test3() {
	}
?>
function test() {
}
/*
function test2() {
}
*/
function test3() {
}
?>

I’ve also noticed this with after multiple lines string concatenation in js.

This is really annoying and can totally mess up the code after a “reindent all”.

0 Likes

#2

I can see that there are problems with sublime text reindent function :frowning:

0 Likes

#3

A lot of problem of indentation !

Like SQL query in $var + comment you get crazy indent and some times crash… I use TextMate to restore a good indentation …

0 Likes

#4

For what it’s worth, it’s broken after commens in Python mode too. Try:

for i in range(5): some code

(works great)

but:

def f():
    for i in range(5): # loop 5 times
    oops_no_indent!

not too smart.

Frankly, reindent is pretty weak all around, at least with python (sigh).

0 Likes