Sublime Forum

indentNextLinePattern supported?

#1

Is the keyword indentNextLinePattern supported in the tmPreference files ?
If I look at languages like C and java the regexp for this keyword are defined but it seems to have no effect :
For example, when I type, in a C file

if(test)
a=b

the second line is not indented as expected, even if I try to select both line and do “Reindent”.
Am i missing something obvious, in the option maybe ? or is this not supported yet ?

0 Likes

#2

Bump.
No one else has this indentation issue ?

0 Likes

#3

Yeah. I, too, have this issue. It could probably be fixed fairly easily but I havent got around to it. It has no problem if you use curly braces but doesn’t recognize the shorthand.

I’ll take a look at it.

0 Likes

#4

Thanks for the feedback.

0 Likes

#5

I’m assuming you were asking about indentNextLinePattern due to your SystemVerilog plugin. I’ve started to use your plugin and noticed the lack of indentation after an if without a begin (i.e. a single line if) and decided to look into it. I saw the C++ plugin uses bracketIndentNextLinePattern instead of indentNextLinePattern so I uncommented the indentNextLinePattern in SystemVerilog.tmPreferences and changed it to bracketIndentNextLinePattern. I also had to tweak the regular expression to use ^\s* instead of \b, otherwise it was only doing the indentation if the ‘if’ was at the start of the line. Note you can turn off the indentation of the next line for bracketIndentNextLinePattern by setting the sublime text smart_indent preference to false. There is also a disableIndentNextLinePattern supported in the tmPreference files that disables the indentation of the next line if the next line matches that pattern. I have that setup to disable the indentation if a begin is on the next line. Therefore I have added the following to my SystemVerilog.tmPreferences

<key>bracketIndentNextLinePattern</key> <string>^\s*(if|else|for|foreach)\b</string> <key>disableIndentNextLinePattern</key> <string>(.*\bbegin\b)</string>

0 Likes