debug

package
v0.0.0-...-b53068c Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: BSD-3-Clause Imports: 34 Imported by: 0

Documentation

Overview

Package debug exports debug information for gopls.

Index

Constants

View Source
const (
	PlainText = PrintMode(iota)
	Markdown
	HTML
)

Variables

View Source
var Version = "master"

Version is a manually-updated mechanism for tracking versions.

Functions

func PrintVersionInfo

func PrintVersionInfo(ctx context.Context, w io.Writer, verbose bool, mode PrintMode)

PrintVersionInfo writes version information to w, using the output format specified by mode. verbose controls whether additional information is written, including section headers.

func WithInstance

func WithInstance(ctx context.Context, workdir, agent string) context.Context

WithInstance creates debug instance ready for use using the supplied configuration and stores it in the returned context.

Types

type Client

type Client struct {
	Session      *cache.Session
	DebugAddress string
	Logfile      string
	GoplsPath    string
	ServerID     string
}

A Client is an incoming connection from a remote client.

type Instance

type Instance struct {
	Logfile              string
	StartTime            time.Time
	ServerAddress        string
	DebugAddress         string
	ListenedDebugAddress string
	Workdir              string
	OCAgentConfig        string

	LogWriter io.Writer

	State *State
	// contains filtered or unexported fields
}

An Instance holds all debug information associated with a gopls instance.

func GetInstance

func GetInstance(ctx context.Context) *Instance

func (*Instance) MonitorMemory

func (i *Instance) MonitorMemory(ctx context.Context)

MonitorMemory starts recording memory statistics each second.

func (*Instance) PrintServerInfo

func (i *Instance) PrintServerInfo(ctx context.Context, w io.Writer)

PrintServerInfo writes HTML debug info to w for the Instance.

func (*Instance) Serve

func (i *Instance) Serve(ctx context.Context) error

Serve starts and runs a debug server in the background. It also logs the port the server starts on, to allow for :0 auto assigned ports.

func (*Instance) SetLogFile

func (i *Instance) SetLogFile(logfile string, isDaemon bool) (func(), error)

SetLogFile sets the logfile for use with this instance.

type PrintMode

type PrintMode int

type Server

type Server struct {
	ID           string
	DebugAddress string
	Logfile      string
	GoplsPath    string
	ClientID     string
}

A Server is an outgoing connection to a remote LSP server.

type State

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

State holds debugging information related to the server state.

func (*State) Cache

func (st *State) Cache(id string) *cache.Cache

Cache returns the Cache that matches the supplied id.

func (*State) Caches

func (st *State) Caches() []*cache.Cache

Caches returns the set of Cache objects currently being served.

func (*State) Client

func (st *State) Client(id string) *Client

Client returns the Client matching the supplied id.

func (*State) Clients

func (st *State) Clients() []*Client

Clients returns the set of Clients currently being served.

func (*State) Servers

func (st *State) Servers() []*Server

Servers returns the set of Servers the instance is currently connected to.

func (*State) Session

func (st *State) Session(id string) *cache.Session

Session returns the Session that matches the supplied id.

func (*State) Sessions

func (st *State) Sessions() []*cache.Session

Sessions returns the set of Session objects currently being served.

func (*State) View

func (st *State) View(id string) *cache.View

View returns the View that matches the supplied id.

func (*State) Views

func (st *State) Views() []*cache.View

Views returns the set of View objects currently being served.

Directories

Path Synopsis
Package tag provides the labels used for telemetry throughout gopls.
Package tag provides the labels used for telemetry throughout gopls.

Jump to

Keyboard shortcuts

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