On 08.02.24 21:37, Erik Wienhold wrote:
>> Modifiers such as + or S in \dS are not covered by autocompletion.
>> src/bin/psql/tab-complete.c only specifies backslash commands in their
>> basic form (without modifiers).
>>
>> (\dS<TAB> actually autocompletes to \ds to my surprise)
>>
>Aha... I never noticed it. Well, with most commands having 1 - 3
>characters it is not a surprised I never used it :)
>That "\dS<TAB>" autocompletes to "\ds " surprises me even more.
>Thanks for pointing out!
--//--
Good evening, dear all!
Here is the mechanism that implements this:
https://github.com/postgres/postgres/blob/b619852086ed2b5df76631f5678f60d3bebd3745/src/bin/psql/tab-complete.h
.
.
.
1673 /* Match the last N words before point, case-sensitively. */
1674 #define TailMatchesCS(...) \
1675 TailMatchesImpl(true, previous_words_count, previous_words, \
1676 VA_ARGS_NARGS(__VA_ARGS__), __VA_ARGS__)
.
.
.
4824 else if (TailMatchesCS("\\ds*"))
4825 COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
.
.
.
There is a rather large list of meta-commands that are handled by TailMatchesCS(...).
For example:
\ENCODING<TAB> autocompletes to \encoding
\eNcOdInG<TAB> autocompletes to \encoding
\dU<TAB> or \DU<TAB> autocompletes to \du
Including the command under discussion:
\CONNINFO<TAB> autocompletes to \conninfo
For the meta-commands[+], there is no autocomplete.
Regards,
Maiquel Grassi.