From efb762de6fb0012cf234ab6ebc103306d20940db Mon Sep 17 00:00:00 2001 From: Tobias Guggenmos Date: Wed, 17 Jun 2020 15:01:47 +0200 Subject: [PATCH] store initializeParams on initailisation Signed-off-by: Tobias Guggenmos --- langserver/codeLens.go | 5 +---- langserver/general.go | 4 +++- langserver/server.go | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/langserver/codeLens.go b/langserver/codeLens.go index 10dc19ef..438edb48 100644 --- a/langserver/codeLens.go +++ b/langserver/codeLens.go @@ -20,9 +20,6 @@ import ( // CodeLens is required by the protocol.Server interface. func (s *server) CodeLens(_ context.Context, _ *protocol.CodeLensParams) ([]protocol.CodeLens, error) { - // As of version 0.4.0 of gopls it is not possible to instruct the language - // client to stop asking for Code Lenses and Document Links. To prevent - // VS Code from showing error messages, this feature is implemented by - // returning empty values. + return nil, nil } diff --git a/langserver/general.go b/langserver/general.go index 5a924cf9..47e564fb 100644 --- a/langserver/general.go +++ b/langserver/general.go @@ -23,7 +23,7 @@ import ( // Initialize handles a call from the client to initialize the server. // Required by the protocol.Server interface. -func (s *server) Initialize(_ context.Context, _ *protocol.ParamInitialize) (*protocol.InitializeResult, error) { +func (s *server) Initialize(_ context.Context, paramInitialize *protocol.ParamInitialize) (*protocol.InitializeResult, error) { s.stateMu.Lock() defer s.stateMu.Unlock() @@ -35,6 +35,8 @@ func (s *server) Initialize(_ context.Context, _ *protocol.ParamInitialize) (*pr s.cache.Init() + s.initializeParams = paramInitialize.InitializeParams + return &protocol.InitializeResult{ Capabilities: protocol.ServerCapabilities{ TextDocumentSync: &protocol.TextDocumentSyncOptions{ diff --git a/langserver/server.go b/langserver/server.go index a030d830..bce4bea5 100644 --- a/langserver/server.go +++ b/langserver/server.go @@ -54,8 +54,9 @@ type server struct { Conn *jsonrpc2.Conn client protocol.Client - state serverState - stateMu sync.Mutex + state serverState + stateMu sync.Mutex + initializeParams protocol.InitializeParams cache cache.DocumentCache