summaryrefslogtreecommitdiffstats
path: root/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp')
-rw-r--r--Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp b/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp
index 0cb60c5..80133b0 100644
--- a/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp
+++ b/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp
@@ -7,6 +7,7 @@ SqlFormatterSimplePlugin::SqlFormatterSimplePlugin()
QString SqlFormatterSimplePlugin::format(SqliteQueryPtr query)
{
TokenList tokens = query->tokens;
+ tokens.trimRight();
foreach (TokenPtr token, tokens)
{
if (token->type == Token::KEYWORD && cfg.SqlFormatterSimple.UpperCaseKeywords.get())
@@ -17,6 +18,13 @@ QString SqlFormatterSimplePlugin::format(SqliteQueryPtr query)
token->value = " ";
}
+ if (!tokens.isEmpty())
+ {
+ TokenPtr last = tokens.last();
+ if (last->type != Token::Type::OPERATOR || last->value != ";")
+ tokens << TokenPtr::create(Token::Type::OPERATOR, ";");
+ }
+
return tokens.detokenize();
}