tools: golang.org/x/tools/gopls/integration/parse Index | Files

package parse

import "golang.org/x/tools/gopls/integration/parse"

Package parse provides functions to parse LSP logs. Fully processed logs are returned by ToRLog().

Index

Package Files

parse.go protocol.go rlog.go

func FromClient Uses

func FromClient(msg string) bool

FromClient says if the message is from the client

func FromServer Uses

func FromServer(msg string) bool

FromServer says if the message is from the server

func IsNotify Uses

func IsNotify(msg string) bool

IsNotify says if the message is a notification

func Notifs Uses

func Notifs(m string) interface{}

Notifs returns a pointer to a type suitable for Unmarshal

func Requests Uses

func Requests(m string) interface{}

Requests returns a pointer to a type suitable for Unmarshal

func Responses Uses

func Responses(m string) []interface{}

Responses returns a slice of types, one of which should be suitable for Unmarshal

type LogHist Uses

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

LogHist gets ints, and puts them into buckets: <=10, <=30, 100, 300, 1000, ... It produces a historgram of elapsed times in milliseconds

func (*LogHist) String Uses

func (l *LogHist) String() string

String returns a string describing a histogram

type Logmsg Uses

type Logmsg struct {
    Type    MsgType
    Method  string
    ID      string      // for requests/responses. Client and server request ids overlap
    Elapsed string      // for responses
    Hdr     string      // header. do we need to keep all these strings?
    Rest    string      // the unparsed result, with newlines or not
    Body    interface{} // the parsed result
}

Logmsg is the type of a parsed log entry.

func ReadLogs Uses

func ReadLogs(fname string) ([]*Logmsg, error)

ReadLogs from a file. Most users should use ToRlog().

type MsgType Uses

type MsgType int

MsgType is the type of message.

const (
    // ClRequest from client to server has method and id
    ClRequest MsgType = iota
    // ClResponse from server to client
    ClResponse
    // SvRequest from server to client, has method and id
    SvRequest
    // SvResponse from client to server
    SvResponse
    // ToServer notification has method, but no id
    ToServer
    // ToClient notification
    ToClient
    // ReportErr is an error message
    ReportErr // errors have method and id
)

func (MsgType) String Uses

func (d MsgType) String() string

String returns a user-useful versin of a Direction

type Msgtype Uses

type Msgtype int

Msgtype given method names. Note that mSrv|mCl is possible

const (
    // Mnot for notifications
    Mnot Msgtype = 1
    // Mreq for requests
    Mreq Msgtype = 2
    // Msrv for messages from the server
    Msrv Msgtype = 4
    // Mcl for messages from the client
    Mcl Msgtype = 8
)

type Rlog Uses

type Rlog struct {
    Logs         []*Logmsg          // In the order in the log file
    ServerCall   map[string]*Logmsg // ID->Request, client->server
    ServerReply  map[string]*Logmsg // ID->Response, server->client (includes Errors)
    ClientCall   map[string]*Logmsg
    ClientReply  map[string]*Logmsg
    ClientNotifs []*Logmsg
    ServerNotifs []*Logmsg
    Histogram    *LogHist
}

Rlog contains the processed logs

func ToRlog Uses

func ToRlog(fname string) (*Rlog, error)

ToRlog reads a log file and returns a *Rlog

func (*Rlog) Counts Uses

func (r *Rlog) Counts() string

Counts returns a one-line summary of an Rlog

Package parse imports 9 packages (graph) and is imported by 1 packages. Updated 2020-07-07. Refresh now. Tools for package owners.