mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-27 23:11:20 +08:00
parent
b0a1305db1
commit
64efe7305e
|
@ -206,6 +206,16 @@ func TestComplete(t *testing.T) {
|
|||
ci("local-var1"), ci("local-var2"),
|
||||
},
|
||||
}),
|
||||
// "del" has a similar completer.
|
||||
Args(cb("del "), ev, cfg).Rets(
|
||||
&Result{
|
||||
Name: "argument", Replace: r(4, 4),
|
||||
Items: []modes.CompletionItem{
|
||||
ci("local-fn1~"), ci("local-fn2~"),
|
||||
ci("local-ns1:"), ci("local-ns2:"),
|
||||
ci("local-var1"), ci("local-var2"),
|
||||
},
|
||||
}),
|
||||
|
||||
// Complete commands at an empty buffer, generating special forms,
|
||||
// externals, functions, namespaces and variable assignments.
|
||||
|
|
|
@ -63,6 +63,16 @@ func generateArgs(args []string, ev *eval.Evaler, p np.Path, cfg Config) ([]RawI
|
|||
items = append(items, noQuoteItem(sigil+parse.QuoteVariableName(ns+varname)))
|
||||
})
|
||||
return items, nil
|
||||
case "del":
|
||||
// This partially duplicates eachVariableInNs with ns = "", but we don't
|
||||
// offer builtin variables.
|
||||
var items []RawItem
|
||||
addItem := func(varname string) {
|
||||
items = append(items, noQuoteItem(parse.QuoteVariableName(varname)))
|
||||
}
|
||||
ev.Global().IterateKeysString(addItem)
|
||||
eachDefinedVariable(p[len(p)-1], p[0].Range().From, addItem)
|
||||
return items, nil
|
||||
}
|
||||
|
||||
return cfg.ArgGenerator(args)
|
||||
|
|
Loading…
Reference in New Issue
Block a user