mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
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
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#include <algorithm>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user