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