mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-20 11:48:31 -06:00
Ensure compatibility with newer sqlparse modules. Fixes #1725
This commit is contained in:
parent
e591c6b5c0
commit
a0a6428e86
@ -671,6 +671,11 @@ class SQLAutoComplete(object):
|
||||
full_text, identifier)
|
||||
|
||||
def suggest_based_on_last_token(self, token, text_before_cursor, full_text, identifier):
|
||||
# New version of sqlparse sends tuple, we need to make it
|
||||
# compatible with our logic
|
||||
if isinstance(token, tuple) and len(token) > 1:
|
||||
token = token[1]
|
||||
|
||||
if isinstance(token, string_types):
|
||||
token_v = token.lower()
|
||||
elif isinstance(token, Comparison):
|
||||
|
@ -275,7 +275,7 @@ def parse_partial_identifier(word):
|
||||
n_tok = len(p.tokens)
|
||||
if n_tok == 1 and isinstance(p.tokens[0], Identifier):
|
||||
return p.tokens[0]
|
||||
elif p.token_next_match(0, Error, '"'):
|
||||
elif hasattr(p, 'token_next_match') and p.token_next_match(0, Error, '"'):
|
||||
# An unmatched double quote, e.g. '"foo', 'foo."', or 'foo."bar'
|
||||
# Close the double quote, then reparse
|
||||
return parse_partial_identifier(word + '"')
|
||||
|
Loading…
Reference in New Issue
Block a user