session

package
v0.0.0-...-9ded4d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory func(context.Context) ServiceSession

Factory is a callback function used for creating a ServiceSession with the provided context

type ServiceSession

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

ServiceSession is an interface used to instantiate a JSON-RPC service

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is a struct that represents an individual language server workspace

func New

func New(cancelFunc context.CancelFunc) *Session

New instantiates a new language server workspace session

func (*Session) EnsureInitialized

func (s *Session) EnsureInitialized() error

EnsureInitialized will return an error if the current session is not initialized

func (*Session) Exit

func (s *Session) Exit() error

Exit will attempt to exit out of an exitable session

func (*Session) FinishInitialization

func (s *Session) FinishInitialization(req *jrpc2.Request) error

FinishInitialization will attempt to set the state of the session to "initialized"

func (*Session) GetState

func (s *Session) GetState() State

GetState will return the current state of a session

func (*Session) Init

func (s *Session) Init(req *jrpc2.Request) error

Init will attempt to initialize a session

func (*Session) Prepare

func (s *Session) Prepare() error

Prepare will attempt to set a session's state to "prepared"

func (*Session) Shutdown

func (s *Session) Shutdown(req *jrpc2.Request) error

Shutdown will attempt to shut down an active session

type State

type State int

State represents the state of the language server session (workspace)

const (
	// StateEmpty is the state of an empty session (before it starts)
	StateEmpty State = -1

	// StatePrepared is the state of a session that's ready to accept requests
	StatePrepared State = 0

	// StateInitializing is the state of a session after "initialize"
	StateInitializing State = 1

	// StateInitialized is the state of a session after "initialized"
	StateInitialized State = 2

	// StateShutdown is the state of a session after it has been shut down
	StateShutdown State = 3
)

func (State) String

func (state State) String() string

ToString will return a string representation of the given session state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL