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

package cmd

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

Package cmd handles the gopls command line. It contains a handler for each of the modes, along with all the flag handling and the command line output format.

Index

Package Files

check.go cmd.go definition.go format.go info.go query.go serve.go

type Application Uses

type Application struct {

    // Embed the basic profiling flags supported by the tool package
    tool.Profile

    // We include the server configuration directly for now, so the flags work
    // even without the verb.
    // TODO: Remove this when we stop allowing the serve verb by default.
    Serve Serve

    // Support for remote lsp server
    Remote string `flag:"remote" help:"*EXPERIMENTAL* - forward all commands to a remote lsp"`

    // Enable verbose logging
    Verbose bool `flag:"v" help:"Verbose output"`

    // Control ocagent export of telemetry
    OCAgent string `flag:"ocagent" help:"The address of the ocagent, or off"`
    // contains filtered or unexported fields
}

Application is the main application as passed to tool.Main It handles the main command line parsing and dispatch to the sub commands.

func New Uses

func New(name, wd string, env []string) *Application

Returns a new Application ready to run.

func (*Application) DetailedHelp Uses

func (app *Application) DetailedHelp(f *flag.FlagSet)

DetailedHelp implements tool.Application returning the main binary help. This includes the short help for all the sub commands.

func (*Application) Name Uses

func (app *Application) Name() string

Name implements tool.Application returning the binary name.

func (*Application) Run Uses

func (app *Application) Run(ctx context.Context, args ...string) error

Run takes the args after top level flag processing, and invokes the correct sub command as specified by the first argument. If no arguments are passed it will invoke the server sub command, as a temporary measure for compatibility.

func (*Application) ShortHelp Uses

func (app *Application) ShortHelp() string

ShortHelp implements tool.Application returning the main binary help.

func (*Application) Usage Uses

func (app *Application) Usage() string

Usage implements tool.Application returning empty extra argument usage.

type Definition Uses

type Definition struct {
    Span        span.Span `json:"span"`        // span of the definition
    Description string    `json:"description"` // description of the denoted object
}

A Definition is the result of a 'definition' query.

type Serve Uses

type Serve struct {
    Logfile string `flag:"logfile" help:"filename to log to. if value is \"auto\", then logging to a default output file is enabled"`
    Mode    string `flag:"mode" help:"no effect"`
    Port    int    `flag:"port" help:"port on which to run gopls for debugging purposes"`
    Address string `flag:"listen" help:"address on which to listen for remote connections"`
    Trace   bool   `flag:"rpc.trace" help:"Print the full rpc trace in lsp inspector format"`
    Debug   string `flag:"debug" help:"Serve debug information on the supplied address"`
    // contains filtered or unexported fields
}

Serve is a struct that exposes the configurable parts of the LSP server as flags, in the right form for tool.Main to consume.

func (*Serve) DetailedHelp Uses

func (s *Serve) DetailedHelp(f *flag.FlagSet)

func (*Serve) Name Uses

func (s *Serve) Name() string

func (*Serve) Run Uses

func (s *Serve) Run(ctx context.Context, args ...string) error

Run configures a server based on the flags, and then runs it. It blocks until the server shuts down.

func (*Serve) ShortHelp Uses

func (s *Serve) ShortHelp() string

func (*Serve) Usage Uses

func (s *Serve) Usage() string

Package cmd imports 33 packages (graph) and is imported by 2 packages. Updated 2019-09-15. Refresh now. Tools for package owners.