mirror of
https://github.com/golang/go
synced 2024-11-18 19:54:44 -07:00
internal/lsp: handle the didChangeConfiguration message
It uses it to update the config of all active views cleanly Fixes golang/go#32258 Change-Id: I7a849941d5022499d48ad640c5b7bc9cf79eb9b9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/206148 Run-TryBot: Ian Cottrell <iancottrell@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
c41a8f58b5
commit
74addff584
@ -113,8 +113,8 @@ func (s *Server) DidChangeWorkspaceFolders(ctx context.Context, params *protocol
|
|||||||
return s.changeFolders(ctx, params.Event)
|
return s.changeFolders(ctx, params.Event)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) DidChangeConfiguration(context.Context, *protocol.DidChangeConfigurationParams) error {
|
func (s *Server) DidChangeConfiguration(ctx context.Context, params *protocol.DidChangeConfigurationParams) error {
|
||||||
return notImplemented("DidChangeConfiguration")
|
return s.updateConfiguration(ctx, params.Settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error {
|
func (s *Server) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error {
|
||||||
|
@ -43,5 +43,14 @@ func (s *Server) addView(ctx context.Context, name string, uri span.URI) (source
|
|||||||
s.fetchConfig(ctx, name, uri, &options)
|
s.fetchConfig(ctx, name, uri, &options)
|
||||||
|
|
||||||
return s.session.NewView(ctx, name, uri, options)
|
return s.session.NewView(ctx, name, uri, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) updateConfiguration(ctx context.Context, changed interface{}) error {
|
||||||
|
// go through all the views getting the config
|
||||||
|
for _, view := range s.session.Views() {
|
||||||
|
options := s.session.Options()
|
||||||
|
s.fetchConfig(ctx, view.Name(), view.Folder(), &options)
|
||||||
|
view.SetOptions(ctx, options)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user