github.com/nevalang/neva@v0.23.1-0.20240507185603-7696a9bb8dda/cmd/lsp/server/general_messages.go (about)

     1  package server
     2  
     3  import (
     4  	"github.com/tliron/glsp"
     5  	protocol "github.com/tliron/glsp/protocol_3_16"
     6  )
     7  
     8  func (s *Server) Initialize(glspCtx *glsp.Context, params *protocol.InitializeParams) (any, error) {
     9  	s.workspacePath = *params.RootPath
    10  	return protocol.InitializeResult{
    11  		Capabilities: s.handler.CreateServerCapabilities(),
    12  		ServerInfo: &protocol.InitializeResultServerInfo{
    13  			Name:    s.name,
    14  			Version: &s.version,
    15  		},
    16  	}, nil
    17  }
    18  
    19  func (s *Server) Initialized(glspCtx *glsp.Context, params *protocol.InitializedParams) error {
    20  	return s.indexAndNotifyProblems(glspCtx.Notify)
    21  }
    22  
    23  func (s *Server) Shutdown(context *glsp.Context) error {
    24  	protocol.SetTraceValue(protocol.TraceValueOff)
    25  	return nil
    26  }
    27  
    28  func (s Server) Exit(_ *glsp.Context) error {
    29  	return nil
    30  }
    31  
    32  func (s Server) SetTrace(_ *glsp.Context, params *protocol.SetTraceParams) error {
    33  	protocol.SetTraceValue(params.Value)
    34  	return nil
    35  }