summaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:41 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:41 -0500
commit8e640722c62692818ab840d50b3758f89a41a54e (patch)
tree38197eb1688a5afc338081ea17e15f938976e422 /Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
parent9618f0ebbf4b88045247c01ce8c8f58203508ebf (diff)
Imported Upstream version 3.0.7upstream/3.0.7
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h')
-rw-r--r--Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
index 2701745..1f9b6d8 100644
--- a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
+++ b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
@@ -53,6 +53,10 @@ CFG_CATEGORIES(SqlEnterpriseFormatterConfig,
CFG_ENTRY(QString, PrefferedWrapper, getNameWrapperStr(NameWrapper::BRACKET))
CFG_ENTRY(QStringList, Wrappers, getNameWrapperStrings(), false)
CFG_ENTRY(QString, PreviewCode, QString(), false)
+ CFG_ENTRY(bool, MoveAllCommentsToLineEnd, false)
+ CFG_ENTRY(bool, LineUpCommentsAtLineEnd, true)
+ CFG_ENTRY(QString, PreferredCommentMarker, "--")
+ CFG_ENTRY(QStringList, CommentMarkers, QStringList({"--", "/* */"}))
)
)
@@ -73,6 +77,25 @@ class SQLENTERPRISEFORMATTERSHARED_EXPORT SqlEnterpriseFormatter : public Generi
void configDialogClosed();
private:
+ struct Comment
+ {
+ int position = 0;
+ QString contents;
+ bool tokensBefore = false;
+ bool tokensAfter = false;
+ bool multiline = false;
+ };
+
+ QList<Comment*> collectComments(const TokenList& tokens);
+ QString applyComments(const QString& formatted, QList<Comment *> comments, Dialect dialect);
+ QList<TokenList> tokensByLines(const TokenList& tokens, bool includeSpaces = false);
+ TokenList adjustCommentsToEnd(const TokenList& inputTokens);
+ TokenList wrapOnlyComments(const TokenList& inputTokens);
+ TokenList optimizeInnerComments(const TokenList& inputTokens);
+ TokenList optimizeEndLineComments(const TokenList& inputTokens);
+ void indentMultiLineComments(const TokenList& inputTokens);
+ void wrapComment(const TokenPtr& token, bool isAtLineEnd);
+
QList<SqliteQueryPtr> previewQueries;
CFG_LOCAL_PERSISTABLE(SqlEnterpriseFormatterConfig, cfg)