From 9682eb53c31c2052839da824f2b660bc708b6217 Mon Sep 17 00:00:00 2001 From: Pawel Salawa Date: Fri, 27 Dec 2024 02:04:45 +0100 Subject: [PATCH] Restored missing completer positions (string, number, blob literal). --- SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp | 3 +++ SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp | 8 ++++---- SQLiteStudio3/coreSQLiteStudio/expectedtoken.h | 10 +++++----- SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp index cd6e2a52cc..af9e145f4b 100644 --- a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp @@ -11,6 +11,9 @@ CompletionComparer::CompletionComparer(CompletionHelper *helper) bool CompletionComparer::operator ()(const ExpectedTokenPtr& token1, const ExpectedTokenPtr& token2) { + if (token2->type == ExpectedToken::OTHER || token1->type == ExpectedToken::OTHER) + qDebug() << ""; + if ((token1->priority > 0 || token2->priority > 0) && token1->priority != token2->priority) return token1->priority > token2->priority; diff --git a/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp b/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp index b38e42d5f2..c42c2e851d 100644 --- a/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp @@ -257,13 +257,13 @@ QList CompletionHelper::getExpectedTokens(TokenPtr token) results += getExpectedToken(ExpectedToken::OTHER, QString(), QString(), tr("Any word")); break; case Token::STRING: - results += getExpectedToken(ExpectedToken::STRING); + results += getExpectedToken(ExpectedToken::STRING, QString(), QString(), tr("String")); break; case Token::FLOAT: - results += getExpectedToken(ExpectedToken::NUMBER); + results += getExpectedToken(ExpectedToken::NUMBER, QString(), QString(), tr("Number")); break; case Token::INTEGER: - results += getExpectedToken(ExpectedToken::NUMBER); + results += getExpectedToken(ExpectedToken::NUMBER, QString(), QString(), tr("Number")); break; case Token::OPERATOR: results += getExpectedToken(ExpectedToken::OPERATOR, token->value); @@ -275,7 +275,7 @@ QList CompletionHelper::getExpectedTokens(TokenPtr token) results += getExpectedToken(ExpectedToken::OPERATOR, ")"); break; case Token::BLOB: - results += getExpectedToken(ExpectedToken::BLOB); + results += getExpectedToken(ExpectedToken::BLOB, QString(), QString(), tr("BLOB literal")); break; case Token::KEYWORD: results += getExpectedToken(ExpectedToken::KEYWORD, token->value); diff --git a/SQLiteStudio3/coreSQLiteStudio/expectedtoken.h b/SQLiteStudio3/coreSQLiteStudio/expectedtoken.h index 2064c8e685..df5a7d4ee0 100644 --- a/SQLiteStudio3/coreSQLiteStudio/expectedtoken.h +++ b/SQLiteStudio3/coreSQLiteStudio/expectedtoken.h @@ -23,15 +23,15 @@ struct API_EXPORT ExpectedToken VIEW, DATABASE, NO_VALUE, + STRING, + NUMBER, + BLOB, + OTHER, KEYWORD, FUNCTION, OPERATOR, COLLATION, - PRAGMA, - STRING, - NUMBER, - BLOB, - OTHER + PRAGMA }; /** diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp index b80d45add8..aa99ee1d68 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp @@ -214,7 +214,8 @@ void Parser::expectedTokenLookup(void* pParser) Token::CTX_ALIAS, Token::CTX_TABLE_NEW, Token::CTX_INDEX_NEW, Token::CTX_TRIGGER_NEW, Token::CTX_VIEW_NEW, Token::CTX_COLUMN_NEW, Token::CTX_TRANSACTION, Token::CTX_CONSTRAINT, Token::CTX_COLUMN_TYPE, Token::CTX_OLD_KW, Token::CTX_NEW_KW, - Token::CTX_ROWID_KW, Token::CTX_STRICT_KW, Token::INVALID + Token::CTX_ROWID_KW, Token::CTX_STRICT_KW, Token::INVALID, + Token::BLOB, Token::STRING, Token::FLOAT, Token::INTEGER }); for (TokenPtr token : tokenSet)