Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Indentation inside SQL queries #28

Closed
OlofT opened this Issue Nov 7, 2012 · 1 comment

Comments

Projects
None yet
2 participants

OlofT commented Nov 7, 2012

When writing a query, indentation is altered in unexpected manners when editing the last line having the quotation after the insertion point. Like this, the blinking marker is shown with a |

$query = sprintf("SELECT id
                  FROM a_table
                  WHERE some_value = 2
                  |");

Now if I start typing it will move one indent to the left resulting in:

$query = sprintf("SELECT id
                  FROM a_table
                  WHERE some_value = 2
            AND some_other_value = 1");

This is of-course not the end of the world, but the underlying bug that causes this issue might stir up problems in other places as well.

OlofT commented Jul 3, 2013

Now we get the following errors instead, the blinking marker is again shown with a |

Inside the string we get a single indent (which might be ok, but slightly annoying):

$query = sprintf("SELECT id
       |

You have to manually indent the string to the right level, but it will go back again on the next line:

$query = sprintf("SELECT id
                            FROM a_table
    |

And so on for each line, until we close the string and the indent goes up to the string's indent level:

$query = sprintf("SELECT id
                         FROM a_table
                         WHERE some_value = 2
                         AND some_other_value = 1");
                         |

Now it is really hard to get back to the original indent level, since the caret will always move up to line with the string. The only way to get back to the right indent level is to type some text, highlight the added indents and delete them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment