mirror of
https://github.com/dbcli/pgcli.git
synced 2024-10-06 02:07:53 +03:00
Fix multiple columns for aliased tables.
This commit is contained in:
parent
7492594c37
commit
be322144c3
8
TODO
8
TODO
@ -1,8 +1,4 @@
|
||||
# vi: ft=vimwiki
|
||||
* [ ] Skip the password prompt by default. It should only be presented if -W option is provided.
|
||||
* [ ] Detect a '.' and parse the word before it and get it's real name.
|
||||
* [ ] Multiple cols for dot is failing.
|
||||
* [ ] Table detection for INSERT INTO is not stopping after it encounters the lparen.
|
||||
* [ ] Bottom status bar is cut-off in half pane. Figure out how to fix that.
|
||||
* [ ] Column completion for nested sql.
|
||||
* [ ] Add JOIN to the list of keywords and provide proper autocompletion for it.
|
||||
@ -28,3 +24,7 @@
|
||||
* [X] Fix: Autocompletion won't go away after semi-colons. This an artifact of stripping special chars in the partially typed words. Need to selectively remove parens.
|
||||
* [X] Fix: SELECT id, <tab> FROM django_migrations; - Auto-completion for the second column name is broken. Find the last keyword and use it for completion.
|
||||
* [X] Show only table sensitive columns in autocompletion.
|
||||
* [X] Skip the password prompt by default. It should only be presented if -W option is provided.
|
||||
* [X] Detect a '.' and parse the word before it and get it's real name.
|
||||
* [X] Multiple cols for dot is failing.
|
||||
* [X] Table detection for INSERT INTO is not stopping after it encounters the lparen.
|
||||
|
@ -59,8 +59,9 @@ def suggest_based_on_last_token(token, text_before_cursor, full_text):
|
||||
prev_keyword = find_prev_keyword(text_before_cursor)
|
||||
return suggest_based_on_last_token(prev_keyword, text_before_cursor, full_text)
|
||||
elif token_v.endswith('.'):
|
||||
current_alias = last_word(token_v[:-1])
|
||||
tables = extract_tables(full_text, include_alias=True)
|
||||
return 'columns', [tables.get(token.token_first().value)]
|
||||
return 'columns', [tables.get(current_alias)]
|
||||
else:
|
||||
return 'keywords', []
|
||||
|
||||
|
@ -66,3 +66,8 @@ def test_dot_suggests_cols_of_an_alias():
|
||||
suggestion = suggest_type('SELECT t1. FROM tabl1 t1, tabl2 t2',
|
||||
'SELECT t1.')
|
||||
assert suggestion == ('columns', ['tabl1'])
|
||||
|
||||
def test_dot_col_comma_suggests_cols():
|
||||
suggestion = suggest_type('SELECT t1.a, t2. FROM tabl1 t1, tabl2 t2',
|
||||
'SELECT t1.a, t2.')
|
||||
assert suggestion == ('columns', ['tabl2'])
|
||||
|
Loading…
Reference in New Issue
Block a user