From 8e640722c62692818ab840d50b3758f89a41a54e Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 25 Nov 2015 16:48:41 -0500 Subject: Imported Upstream version 3.0.7 --- .../sqlenterpriseformatter.h | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h') 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 collectComments(const TokenList& tokens); + QString applyComments(const QString& formatted, QList comments, Dialect dialect); + QList 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 previewQueries; CFG_LOCAL_PERSISTABLE(SqlEnterpriseFormatterConfig, cfg) -- cgit v1.2.3