Skip to content
Snippets Groups Projects
Commit de7730ca authored by Malte Bauch's avatar Malte Bauch
Browse files

Allow to update suggestions through function if it failed before

parent c8f47fc0
No related branches found
No related tags found
1 merge request!548Draft: Resolve "Deadline and Cancellation for gRPC calls"
Pipeline #161121 passed with warnings
...@@ -229,13 +229,13 @@ func (pc *PromptCompleter) updateSuggestionsThroughFunc(d prompt.Document, c *co ...@@ -229,13 +229,13 @@ func (pc *PromptCompleter) updateSuggestionsThroughFunc(d prompt.Document, c *co
if pc.lastSuggestions == nil { if pc.lastSuggestions == nil {
var err error var err error
newSuggestions, err := fn() newSuggestions, err := fn()
if err != nil {
return prompt.FilterHasPrefix([]prompt.Suggest{}, d.GetWordBeforeCursor(), true)
}
pc.lastSuggestions = &suggestionTracker{ pc.lastSuggestions = &suggestionTracker{
lastCommand: c, lastCommand: c,
lastSuggestion: newSuggestions, lastSuggestion: newSuggestions,
} }
if err != nil {
return prompt.FilterHasPrefix(pc.lastSuggestions.lastSuggestion, d.GetWordBeforeCursor(), true)
}
} }
return prompt.FilterHasPrefix(pc.lastSuggestions.lastSuggestion, d.GetWordBeforeCursor(), true) return prompt.FilterHasPrefix(pc.lastSuggestions.lastSuggestion, d.GetWordBeforeCursor(), true)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment