cmd

package
v0.0.0-...-aa82965 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {

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

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

	// An initial, common go/packages configuration
	Config packages.Config
}

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

func (*Application) DetailedHelp

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

func (app *Application) Name() string

Name implements tool.Application returning the binary name.

func (*Application) Run

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

func (app *Application) ShortHelp() string

ShortHelp implements tool.Application returning the main binary help.

func (*Application) Usage

func (app *Application) Usage() string

Usage implements tool.Application returning empty extra argument usage.

type Definition

type Definition struct {
	Location    Location `json:"location"`    // location of the definition
	Description string   `json:"description"` // description of the denoted object
}

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

type Location

type Location struct {
	Filename string   `json:"file"`
	Start    Position `json:"start"`
	End      Position `json:"end"`
}

func (Location) Format

func (l Location) Format(f fmt.State, c rune)

type Position

type Position struct {
	Line   int `json:"line"`
	Column int `json:"column"`
	Offset int `json:"offset"`
}

func (Position) Format

func (p Position) Format(f fmt.State, c rune)

type Server

type Server 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"`
}

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

func (*Server) DetailedHelp

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

func (*Server) Name

func (s *Server) Name() string

func (*Server) Run

func (s *Server) 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 (*Server) ShortHelp

func (s *Server) ShortHelp() string

func (*Server) Usage

func (s *Server) Usage() string

Jump to

Keyboard shortcuts

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