Commit 195626fc authored by's avatar

Docs for ghci completion command for ghci; part of #5687. Patch from hvr.

parent 36a54173
......@@ -2178,6 +2178,93 @@ maybe :: b -> (a -> b) -> Maybe a -> b
<literal>:complete</literal> <replaceable>type</replaceable>
<para>This command allows to request command completions
from GHCi even when interacting over a pipe instead of a
proper terminal and is designed for integrating GHCi's
completion with text editors and IDEs.</para>
<para>When called, <literal>:complete</literal> prints the
<replaceable>n</replaceable><superscript>th</superscript> to
completion candidates for the partial input
<replaceable>string-literal</replaceable> for the completion
domain denoted by
<replaceable>type</replaceable>. Currently, only the
<literal>repl</literal> domain is supported which denotes
the kind of completion that would be provided interactively
by GHCi at the input prompt.</para>
<para>If omitted, <replaceable>n</replaceable> and
<replaceable>m</replaceable> default to the first or last
available completion candidate respectively. If there are
less candidates than requested via the range argument,
<replaceable>n</replaceable> and
<replaceable>m</replaceable> are implicitly capped to the
number of available completition candidates.</para>
<para>The output of <literal>:complete</literal> begins with
a header line containing three space-delimited fields:
<listitem>An integer denoting the number
<replaceable>l</replaceable> of printed
<listitem>an integer denoting the total number of
completions available, and finally</listitem>
<listitem>a string literal denoting a common
prefix to be added to the returned completion
The header line is followed by <replaceable>l</replaceable>
lines each containing one completion candidate encoded as
(quoted) string literal. Here are some example invocations
showing the various cases:</para>
Prelude&gt; :complete repl 0 ""
0 470 ""
Prelude&gt; :complete repl 5 "import For"
5 21 "import "
Prelude&gt; :complete repl 5-10 "import For"
6 21 "import "
Prelude&gt; :complete repl 20- "import For"
2 21 "import "
Prelude&gt; :complete repl "map"
3 3 ""
Prelude&gt; :complete repl 5-10 "map"
0 3 ""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment