Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add alter and drop autocomplete #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rubiagatra
Copy link
Contributor

complete #196

Hello @nineinchnick, I believe I've created the most commonly used ALTER and DROP autocompletions. Will this close #196, or do I need to be more comprehensive about this?

@@ -353,6 +353,17 @@ func (c completer) complete(previousWords []string, text []rune) [][]rune {
if TailMatches(IGNORE_CASE, previousWords, "CREATE", "TABLE", "*") || TailMatches(IGNORE_CASE, previousWords, "CREATE", "TEMP|TEMPORARY", "TABLE", "*") {
return CompleteFromList(text, "(")
}

/* Complete ALTER */
if TailMatches(IGNORE_CASE, previousWords, "ALTER") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start, but would be great if this also completed table names. See https://github.com/postgres/postgres/blob/master/src/bin/psql/tab-complete.c#L1814 for reference, and also check a few lines below how we already do this for INSERT INTO.

Completing other objects like index names would also be great, but we can stick to tables in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete for DDL commands
2 participants