Skip to content

Commit

Permalink
store initializeParams on initailisation
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Guggenmos <[email protected]>
  • Loading branch information
slrtbtfs committed Mar 25, 2022
1 parent 463023c commit efb762d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 1 addition & 4 deletions langserver/codeLens.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 3 additions & 1 deletion langserver/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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{
Expand Down
5 changes: 3 additions & 2 deletions langserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit efb762d

Please sign in to comment.