command

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: BSD-3-Clause Imports: 51 Imported by: 0

Documentation

Overview

Package command provides the command of Go language development for Neovim.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Definition

func Definition(q *guru.Query) (*serial.Definition, error)

Definition parse definition from the current cursor.

func RewriteFile

func RewriteFile(fset *token.FileSet, f *ast.File, info types.Info)

RewriteFile rewrites f with 'if err' Go idiom.

Types

type CmdBuildEval

type CmdBuildEval struct {
	Cwd  string `msgpack:",array"`
	File string
}

CmdBuildEval struct type for Eval of GoBuild command.

type CmdConfigEval

type CmdConfigEval struct {
	Cwd  string `msgpack:",array"`
	File string
}

CmdConfigEval represents for the eval of GoConfig command.

type CmdVetEval

type CmdVetEval struct {
	Cwd  string `msgpack:",array"`
	File string
}

CmdVetEval struct type for Eval of GoBuild command.

type Command

type Command struct {
	Nvim *nvim.Nvim
	// contains filtered or unexported fields
}

Command represents a nvim-go plugins commands.

func NewCommand

func NewCommand(ctx context.Context, v *nvim.Nvim, bctxt *buildctxt.Context) *Command

NewCommand return the new Command type with initialize some variables.

func Register

func Register(ctx context.Context, p *plugin.Plugin, bctxt *buildctxt.Context) *Command

Register register nvim-go command or function to Neovim over the msgpack-rpc plugin interface.

func (*Command) Build

func (c *Command) Build(pctx context.Context, args []string, bang bool, eval *CmdBuildEval) interface{}

Build builds the current buffers package use compile tool that determined from the package directory structure.

func (*Command) Config

func (c *Command) Config(ctx context.Context, args []string, eval *CmdConfigEval) interface{}

Config configs nvim-go plugin specific config. Such as enable appengine mode, set GOPATH for project or etc.

func (*Command) Fmt

func (c *Command) Fmt(pctx context.Context, dir string) interface{}

Fmt format to the current buffer source uses gofmt behavior.

func (*Command) GenerateTest

func (c *Command) GenerateTest(ctx context.Context, args []string, ranges [2]int, bang bool, dir string) error

GenerateTest generates the test files based by current buffer or args files functions.

func (*Command) Guru

func (c *Command) Guru(pctx context.Context, args []string, eval *funcGuruEval) interface{}

Guru go source analysis and output result to the quickfix or locationlist.

func (*Command) Iferr

func (c *Command) Iferr(ctx context.Context, file string) error

Iferr automatically insert 'if err' Go idiom by parse the current buffer's Go abstract syntax tree(AST).

func (*Command) Lint

func (c *Command) Lint(ctx context.Context, args []string, file string) interface{}

Lint lints a go source file. The argument is a filename or directory path. TODO(zchee): Support go packages.

func (*Command) Metalinter

func (c *Command) Metalinter(ctx context.Context, cwd string) error

Metalinter lint the Go sources from current buffer's package use gometalinter tool.

func (*Command) Rename

func (c *Command) Rename(pctx context.Context, args []string, bang bool, eval *cmdRenameEval) interface{}

Rename rename the current cursor word use golang.org/x/tools/refactor/rename.

func (*Command) Run

func (c *Command) Run(ctx context.Context, args []string, file string) error

Run runs the go run command for current buffer's packages.

func (*Command) SwitchTest

func (c *Command) SwitchTest(ctx context.Context, eval *cmdTestSwitchEval) error

SwitchTest switch to the corresponds current cursor (Test)function.

func (*Command) Test

func (c *Command) Test(ctx context.Context, args []string, dir string) error

Test run the package test command use compile tool that determined from the directory structure.

func (*Command) Vet

func (c *Command) Vet(pctx context.Context, args []string, eval *CmdVetEval) interface{}

Vet is a simple checker for static errors in Go source code use go tool vet command.

type Config

type Config struct {
	Project map[string]ProjectConfig `yaml:"project"`
}

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

func (*Config) Unmarshal

func (c *Config) Unmarshal() (*Config, error)

type ProjectConfig

type ProjectConfig struct {
	GOPATH      string `yaml:"gopath"`
	IsAppengine bool   `yaml:"is_appengine"`
	IsGb        bool   `yaml:"is_not_gb"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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