Skip to content

Commit 36ba6a5

Browse files
committed
internal/lsp: suppress error message when there is no config
Change-Id: I04d26ec3967f6515703142a11fc88b115890ab59 Reviewed-on: https://go-review.googlesource.com/c/tools/+/170185 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Cottrell <[email protected]>
1 parent 5bca5db commit 36ba6a5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/lsp/server.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,18 +632,21 @@ func (s *Server) FoldingRanges(context.Context, *protocol.FoldingRangeParams) ([
632632
}
633633

634634
func (s *Server) processConfig(view *cache.View, config interface{}) error {
635-
//TODO: we should probably store and process more of the config
635+
// TODO: We should probably store and process more of the config.
636+
if config == nil {
637+
return nil // ignore error if you don't have a config
638+
}
636639
c, ok := config.(map[string]interface{})
637640
if !ok {
638-
return fmt.Errorf("Invalid config gopls type %T", config)
641+
return fmt.Errorf("invalid config gopls type %T", config)
639642
}
640643
env := c["env"]
641644
if env == nil {
642645
return nil
643646
}
644647
menv, ok := env.(map[string]interface{})
645648
if !ok {
646-
return fmt.Errorf("Invalid config gopls.env type %T", env)
649+
return fmt.Errorf("invalid config gopls.env type %T", env)
647650
}
648651
for k, v := range menv {
649652
view.Config.Env = applyEnv(view.Config.Env, k, v)

0 commit comments

Comments
 (0)