Sublime Forum

Code indentation bug?

#1

I typically use block comments in Javascript/C with the leading edge aligned like this:

| function foo() {
|     /*
|      * return 4.
|      */
|     return 2 + 2;
| }

Sublime Text 2 b2183’s reindent seems to get confused by the leading space, it changes the code to:

| function foo() {
|     /*
|      * return 4.
|      */
|      return 2 + 2;
|  }

Note that the return line and the closing brace have each been indented a single space.

This happens regardless of whether I use tabs or spaces for indentation.

Aside from changing how I format comments, is there any workaround?

0 Likes

#2

Reindent also seems to have trouble with variable declaration blocks, for example:

| function() {
|     var x = 2,
|         y = x * 2;
|
|     return x + y;
| }

is reindented to:

| function() {
|     var x = 2,
|     y = x * 2;
|
|     return x + y;
| }
0 Likes