From 04bc7da6e715c3e1d5f190e6d3ea1e2cb263db6d Mon Sep 17 00:00:00 2001 From: mgrojo Date: Sun, 9 Sep 2018 15:09:38 +0200 Subject: [PATCH] Better qualified completion support for quoted identifiers The quotes around identifiers was hindering the automatic proposal of fields when the table is completed or of tables when the schema name is completed. By adding the dot surrounded by quotes (parent's end-quote and child's begin-quote) as word separator, the child completion menu is activated when the user presses the child's begin-quote. See related issue #1433 --- src/SqlUiLexer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/SqlUiLexer.cpp b/src/SqlUiLexer.cpp index f53d16cc..76f0b484 100644 --- a/src/SqlUiLexer.cpp +++ b/src/SqlUiLexer.cpp @@ -1,6 +1,9 @@ +#include + #include "SqlUiLexer.h" #include "Qsci/qsciapis.h" #include "Settings.h" +#include "sqlitetypes.h" SqlUiLexer::SqlUiLexer(QObject* parent) : QsciLexerSQL(parent) @@ -184,9 +187,15 @@ QStringList SqlUiLexer::autoCompletionWordSeparators() const { // The only word separator for auto completion in SQL is "." as in "tablename.columnname". // Because this isn't implemented in the default QScintilla SQL lexer for some reason we add it here. - + // We also need to consider quoted identifiers as in "tablename"."columnname" with whatever quote character + // is configured. QStringList wl; - wl << "."; + + QString escapeSeparator = sqlb::escapeIdentifier("."); + // Case for non symetric quotes, e.g. "[.]" to "].[" + std::reverse(escapeSeparator.begin(), escapeSeparator.end()); + + wl << "." << escapeSeparator; return wl; }