diff options
| author | 2015-11-25 16:48:41 -0500 | |
|---|---|---|
| committer | 2015-11-25 16:48:41 -0500 | |
| commit | 8e640722c62692818ab840d50b3758f89a41a54e (patch) | |
| tree | 38197eb1688a5afc338081ea17e15f938976e422 /Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h | |
| parent | 9618f0ebbf4b88045247c01ce8c8f58203508ebf (diff) | |
Imported Upstream version 3.0.7upstream/3.0.7
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h')
| -rw-r--r-- | Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h | 23 |
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) |
