fix php autoindent

This commit is contained in:
nightwing 2012-10-05 21:38:51 +04:00
commit 825469a059

View file

@ -98,16 +98,29 @@ oop.inherits(Mode, TextMode);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start") {
if (state == "php-start") {
var match = line.match(/^.*[\{\(\[\:]\s*$/);
if (match) {
indent += tab;
}
} else if (state == "php-doc-start") {
if (endState != "php-doc-start") {
return "";
}
var match = line.match(/^\s*(\/?)\*/);
if (match) {
if (match[1]) {
indent += " ";
}
indent += "* ";
}
}
return indent;