Skip to content

Commit

Permalink
reflect breaking API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Jul 8, 2021
1 parent 3cca140 commit 11d551c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/langserver/handlers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func (svc *service) Assigner() (jrpc2.Assigner, error) {
return convertMap(m), nil
}

func (svc *service) Finish(status jrpc2.ServerStatus) {
func (svc *service) Finish(_ jrpc2.Assigner, status jrpc2.ServerStatus) {
if status.Closed() || status.Err != nil {
svc.logger.Printf("session stopped unexpectedly (err: %v)", status.Err)
}
Expand Down
11 changes: 6 additions & 5 deletions internal/langserver/langserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func (ls *langServer) StartTCP(address string) error {
// singleServer is a wrapper around jrpc2.NewServer providing support
// for server.Service (Assigner/Finish interface)
type singleServer struct {
srv *jrpc2.Server
finishFunc func(jrpc2.ServerStatus)
srv *jrpc2.Server
svc server.Service
}

func Server(svc server.Service, opts *jrpc2.ServerOptions) (*singleServer, error) {
Expand All @@ -160,8 +160,8 @@ func Server(svc server.Service, opts *jrpc2.ServerOptions) (*singleServer, error
}

return &singleServer{
srv: jrpc2.NewServer(assigner, opts),
finishFunc: svc.Finish,
srv: jrpc2.NewServer(assigner, opts),
svc: svc,
}, nil
}

Expand All @@ -175,8 +175,9 @@ func (ss *singleServer) StartAndWait(ch channel.Channel) {
}

func (ss *singleServer) Wait() {
assigner, _ := ss.svc.Assigner()
status := ss.srv.WaitStatus()
ss.finishFunc(status)
ss.svc.Finish(assigner, status)
}

func (ss *singleServer) Stop() {
Expand Down
2 changes: 1 addition & 1 deletion internal/langserver/session/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type Session interface {
Assigner() (jrpc2.Assigner, error)
Finish(jrpc2.ServerStatus)
Finish(jrpc2.Assigner, jrpc2.ServerStatus)
SetLogger(*log.Logger)
}

Expand Down

0 comments on commit 11d551c

Please sign in to comment.