mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 11:18:00 +01:00
Update (sort-of) the :com -complete docs.
This commit is contained in:
@@ -757,16 +757,14 @@ function Commands() //{{{
|
|||||||
|
|
||||||
if (completeOpt)
|
if (completeOpt)
|
||||||
{
|
{
|
||||||
let func;
|
// TODO: Should we catch any eval error? It'll be reported anyway.
|
||||||
|
|
||||||
if (/^custom,/.test(completeOpt))
|
if (/^custom,/.test(completeOpt))
|
||||||
func = completeOpt.replace("custom,", "");
|
completeFunc = liberator.eval(completeOpt.substr(7));
|
||||||
else
|
else
|
||||||
func = "completion." + completeOptionMap[completeOpt];
|
completeFunc = completion[completeOptionMap[completeOpt]];
|
||||||
|
|
||||||
//completeFunc = eval(func);
|
if (completeFunc == null)
|
||||||
completeFunc = func;
|
return liberator.echoerr("No such completion function");
|
||||||
liberator.log(func)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!commands.addUserCommand(
|
if (!commands.addUserCommand(
|
||||||
@@ -779,7 +777,7 @@ function Commands() //{{{
|
|||||||
count: countOpt,
|
count: countOpt,
|
||||||
// TODO: handle missing function
|
// TODO: handle missing function
|
||||||
//completer: completeFunc,
|
//completer: completeFunc,
|
||||||
completer: function (context, args) eval(completeFunc + "(context, args)"),
|
completer: function (context, args) eval(completeFunc(context, args)),
|
||||||
replacementText: args.literalArg
|
replacementText: args.literalArg
|
||||||
},
|
},
|
||||||
args.bang)
|
args.bang)
|
||||||
|
|||||||
@@ -323,8 +323,10 @@ Completion can be enabled by specifying one of the following arguments to the
|
|||||||
Custom completion
|
Custom completion
|
||||||
|
|
||||||
Custom completion can be provided by specifying the "custom,{func}" argument to
|
Custom completion can be provided by specifying the "custom,{func}" argument to
|
||||||
-complete. The {func} is called with one argument, the word being completed,
|
-complete. The {func} is called with to arguments, a completion context, and
|
||||||
and should return an array [start, completions].
|
an an object describing the command's arguments. It should set the context's
|
||||||
|
'completions' property, or return an object, with 'start' and 'items'
|
||||||
|
properties, describing the completions and where the replacement is to start.
|
||||||
|
|
||||||
*start* is the index into the word being completed at which the returned values
|
*start* is the index into the word being completed at which the returned values
|
||||||
should be applied and *completions* is a two dimensional array of the form:
|
should be applied and *completions* is a two dimensional array of the form:
|
||||||
|
|||||||
Reference in New Issue
Block a user