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 /predict_set.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 'predict_set.go')
| -rw-r--r-- | predict_set.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/predict_set.go b/predict_set.go index 8fc59d7..fa4a34a 100644 --- a/predict_set.go +++ b/predict_set.go @@ -1,7 +1,5 @@ package complete -import "github.com/posener/complete/match" - // PredictSet expects specific set of terms, given in the options argument. func PredictSet(options ...string) Predictor { return predictSet(options) @@ -9,11 +7,6 @@ func PredictSet(options ...string) Predictor { type predictSet []string -func (p predictSet) Predict(a Args) (prediction []string) { - for _, m := range p { - if match.Prefix(m, a.Last) { - prediction = append(prediction, m) - } - } - return +func (p predictSet) Predict(a Args) []string { + return p } |
