diff options
| author | Eyal Posener <[email protected]> | 2017-11-04 10:21:41 +0200 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2017-11-04 10:51:40 +0200 |
| commit | 7ee9623f2b5d4685a91a51d0823275754b4d3a0a (patch) | |
| tree | f45cd54539dd9a03cbb5314bb6a9c0891d013712 /gocomplete/tests.go | |
| parent | 88e59760adaddb8276c9b15511302890690e2dae (diff) | |
Filter matches as a final stage
This simplifies the prediction logic writing, the predictor
doesn't need to filter our according to line matching, instead
it returns everything and the filtering is done at the end.
This does not break current behavior.
Diffstat (limited to 'gocomplete/tests.go')
| -rw-r--r-- | gocomplete/tests.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/gocomplete/tests.go b/gocomplete/tests.go index a952dab..e755ae5 100644 --- a/gocomplete/tests.go +++ b/gocomplete/tests.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/posener/complete" - "github.com/posener/complete/match" ) var ( @@ -21,14 +20,8 @@ var ( // for test names use prefix of 'Test' or 'Example', and for benchmark // test names use 'Benchmark' func funcPredict(funcRegexp *regexp.Regexp) complete.Predictor { - return complete.PredictFunc(func(a complete.Args) (prediction []string) { - tests := funcNames(funcRegexp) - for _, t := range tests { - if match.Prefix(t, a.Last) { - prediction = append(prediction, t) - } - } - return + return complete.PredictFunc(func(a complete.Args) []string { + return funcNames(funcRegexp) }) } |
