From 33748ac28d336190012302877d94540b61d4d7d6 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Tue, 9 Jun 2020 20:47:32 +0800 Subject: [PATCH] Add NoopCompleter --- completion.go | 6 ++++++ completion_test.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/completion.go b/completion.go index 57e82ee..402f59a 100644 --- a/completion.go +++ b/completion.go @@ -188,3 +188,9 @@ func NewCompletionManager(completer Completer, max uint16) *CompletionManager { verticalScroll: 0, } } + +var _ Completer = NoopCompleter + +func NoopCompleter(_ Document) []Suggest { + return nil +} diff --git a/completion_test.go b/completion_test.go index 0b66347..c17c1d9 100644 --- a/completion_test.go +++ b/completion_test.go @@ -204,3 +204,9 @@ func TestFormatText(t *testing.T) { } } } + +func TestNoopCompleter(t *testing.T) { + if NoopCompleter(Document{}) != nil { + t.Errorf("NoopCompleter should return nil") + } +}