tools: golang.org/x/tools/internal/lsp/debug Index | Files

package debug

import "golang.org/x/tools/internal/lsp/debug"

Package debug exports debug information for gopls.

Index

Package Files

info.1.12.go info.go metrics.go rpc.go serve.go trace.go

Constants

const (
    PlainText = PrintMode(iota)
    Markdown
    HTML
)

Variables

var Version = "master"

Version is a manually-updated mechanism for tracking versions.

func PrintVersionInfo Uses

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

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

type Cache Uses

type Cache interface {
    ID() string
    FileSet() *token.FileSet
    MemStats() map[reflect.Type]int
}

A Cache is an in-memory cache.

type Client Uses

type Client interface {
    ID() string
    Session() Session
    DebugAddress() string
    Logfile() string
    ServerID() string
}

A Client is an incoming connection from a remote client.

type File Uses

type File struct {
    Session Session
    URI     span.URI
    Data    string
    Error   error
    Hash    string
}

A File is is a file within a session.

type Instance Uses

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 NewInstance Uses

func NewInstance(workdir, agent string) *Instance

NewInstance creates debug instance ready for use using the supplied configuration.

func (*Instance) FinishSpan Uses

func (i *Instance) FinishSpan(ctx context.Context, spn *telemetry.Span)

func (*Instance) Flush Uses

func (i *Instance) Flush()

func (*Instance) Log Uses

func (i *Instance) Log(ctx context.Context, event telemetry.Event)

func (*Instance) Metric Uses

func (i *Instance) Metric(ctx context.Context, data telemetry.MetricData)

func (*Instance) MonitorMemory Uses

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

MonitorMemory starts recording memory statistics each second.

func (*Instance) PrintServerInfo Uses

func (i *Instance) PrintServerInfo(w io.Writer)

PrintServerInfo writes HTML debug info to w for the Instance.

func (*Instance) Serve Uses

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 Uses

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

SetLogFile sets the logfile for use with this instance.

func (*Instance) StartSpan Uses

func (i *Instance) StartSpan(ctx context.Context, spn *telemetry.Span)

type PrintMode Uses

type PrintMode int

type Server Uses

type Server interface {
    ID() string
    DebugAddress() string
    Logfile() string
    ClientID() string
}

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

type Session Uses

type Session interface {
    ID() string
    Cache() Cache
    Files() []*File
    File(hash string) *File
}

A Session is an LSP serving session.

type State Uses

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

State holds debugging information related to the server state.

func (*State) AddCache Uses

func (st *State) AddCache(cache Cache)

AddCache adds a cache to the set being served.

func (*State) AddClient Uses

func (st *State) AddClient(client Client)

AddClient adds a client to the set being served.

func (*State) AddServer Uses

func (st *State) AddServer(server Server)

AddServer adds a server to the set being queried. In practice, there should be at most one remote server.

func (*State) AddSession Uses

func (st *State) AddSession(session Session)

AddSession adds a session to the set being served.

func (*State) AddView Uses

func (st *State) AddView(view View)

AddView adds a view to the set being served.

func (*State) Caches Uses

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

Caches returns the set of Cache objects currently being served.

func (*State) Clients Uses

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

Clients returns the set of Clients currently being served.

func (*State) DropCache Uses

func (st *State) DropCache(cache Cache)

DropCache drops a cache from the set being served.

func (*State) DropClient Uses

func (st *State) DropClient(client Client)

DropClient adds a client to the set being served.

func (*State) DropServer Uses

func (st *State) DropServer(server Server)

DropServer drops a server to the set being queried.

func (*State) DropSession Uses

func (st *State) DropSession(session Session)

DropSession drops a session from the set being served.

func (*State) DropView Uses

func (st *State) DropView(view View)

DropView drops a view from the set being served.

func (*State) Servers Uses

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

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

func (*State) Sessions Uses

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

Sessions returns the set of Session objects currently being served.

func (*State) Views Uses

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

Views returns the set of View objects currently being served.

type View Uses

type View interface {
    ID() string
    Name() string
    Folder() span.URI
    Session() Session
}

A View is a root directory within a Session.

Package debug imports 33 packages (graph) and is imported by 13 packages. Updated 2020-02-27. Refresh now. Tools for package owners.