1
0
Fork 0

Merge pull request #198 from drocco007/master

Handle a ',' entered before any completions gracefully
This commit is contained in:
Amjith Ramanujam 2015-04-11 12:28:41 -04:00
commit 4161f66cca
2 changed files with 11 additions and 2 deletions

View File

@ -220,6 +220,8 @@ def suggest_based_on_last_token(token, text_before_cursor, full_text, identifier
if prev_keyword:
return suggest_based_on_last_token(
prev_keyword, text_before_cursor, full_text, identifier)
else:
return []
else:
return [{'type': 'keyword'}]

View File

@ -279,3 +279,10 @@ def test_drop_schema_qualified_table_suggests_only_tables():
text = 'DROP TABLE schema_name.table_name'
suggestions = suggest_type(text, text)
assert suggestions == [{'type': 'table', 'schema': 'schema_name'}]
@pytest.mark.parametrize('text', [',', ' ,', 'sel ,'])
def test_handle_pre_completion_comma_gracefully(text):
suggestions = suggest_type(text, text)
assert iter(suggestions)