Re: adding tab completions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: adding tab completions
Date
Msg-id 11475.1537558154@sss.pgh.pa.us
Whole thread Raw
In response to Re: adding tab completions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> The main thing that is bothering me about the remainder is its desire
> to offer single-punctuation-character completions such as "(".  I do
> not see the point of that.  You can't select a completion without
> typing at least one character, so what does it accomplish to offer
> those options, except clutter?

Actually, after poking at it for awhile, I noticed there was a much bigger
problem: tests like

    else if (HeadMatches2("VACUUM", "("))

would continue to fire even if the option list was complete, so that
after typing say

    vacuum ( verbose ) 

you would not get offered any table names, only option names.

I experimented with various fixes for that, but the only one that
worked required extending word_matches() to allow a wildcard in the
middle of a pattern.  (Before it only allowed one at the end; but
it takes just a couple more lines of code to improve that.)  With
that, we can do

    else if (HeadMatches2("VACUUM", "(*") &&
             !HeadMatches2("VACUUM", "(*)"))

and this test will not trigger if the option list is complete.

I've gone ahead and pushed it with those changes.

            regards, tom lane


pgsql-hackers by date:

Previous
From: "Nasby, Jim"
Date:
Subject: Re: How to get active table within a transaction.
Next
From: Arthur Zakirov
Date:
Subject: Re: [HACKERS] proposal: schema variables