github.com/kolbycrouch/elvish@v0.14.1-0.20210614162631-215b9ac1c423/cmd/examples/e3bc/completion.go (about) 1 package main 2 3 import "src.elv.sh/pkg/cli/mode" 4 5 var items = []string{ 6 // Functions 7 "length(", "read(", "scale(", "sqrt(", 8 // Functions in math library 9 "s(", "c(", "a(", "l(", "e(", "j(", 10 // Statements 11 "print ", "if ", "while (", "for (", 12 "break", "continue", "halt", "return", "return (", 13 // Pseudo statements 14 "limits", "quit", "warranty", 15 } 16 17 func candidates() []mode.CompletionItem { 18 candidates := make([]mode.CompletionItem, len(items)) 19 for i, item := range items { 20 candidates[i] = mode.CompletionItem{ToShow: item, ToInsert: item} 21 } 22 return candidates 23 }