diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go index 1c378ead69..1a1bbe5390 100644 --- a/internal/lsp/source/options.go +++ b/internal/lsp/source/options.go @@ -250,6 +250,10 @@ func (o *Options) set(name string, value interface{}) OptionResult { result.setBool(&o.Completion.CaseSensitive) case "completeUnimported": result.setBool(&o.Completion.Unimported) + case "completionTimeout": + if v, ok := result.asInt(); ok { + o.Completion.Budget = time.Duration(v) * time.Second + } case "hoverKind": hoverKind, ok := value.(string) @@ -347,6 +351,15 @@ func (r *OptionResult) asBool() (bool, bool) { return b, true } +func (r *OptionResult) asInt() (int, bool) { + b, ok := r.Value.(int) + if !ok { + r.errorf("Invalid type %T for int option %q", r.Value, r.Name) + return 0, false + } + return b, true +} + func (r *OptionResult) setBool(b *bool) { if v, ok := r.asBool(); ok { *b = v