golang

package
v0.0.0-...-52b1b20 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssignmentScope = cursor.AssignmentScope
	BlockScope      = cursor.BlockScope
	CommentScope    = cursor.CommentScope
	ConstScope      = cursor.ConstScope
	DeferScope      = cursor.DeferScope
	DocScope        = cursor.DocScope
	ExprScope       = cursor.ExprScope
	FileScope       = cursor.FileScope
	FuncDeclScope   = cursor.FuncDeclScope
	IdentScope      = cursor.IdentScope
	ImportPathScope = cursor.ImportPathScope
	ImportScope     = cursor.ImportScope
	PackageScope    = cursor.PackageScope
	ReturnScope     = cursor.ReturnScope
	SelectorScope   = cursor.SelectorScope
	StringScope     = cursor.StringScope
	TypeDeclScope   = cursor.TypeDeclScope
	VarScope        = cursor.VarScope
)
View Source
const (
	ParseFileMode = goutil.ParseFileMode
)

Variables

View Source
var (
	GoFmt     mg.Reducer = mg.NewReducer(goFmt)
	GoImports mg.Reducer = mg.NewReducer(goImports)
)
View Source
var (
	NilPkgName   = goutil.NilPkgName
	NilFset      = goutil.NilFset
	NilPkgSrc    = goutil.NilPkgSrc
	NilAstFile   = goutil.NilAstFile
	NilTokenFile = goutil.NilTokenFile
)
View Source
var (
	VersionTag = goutil.VersionTag
	Version    = goutil.Version
)
View Source
var Reducers = []mg.Reducer{}

Functions

func AppendSnippet

func AppendSnippet(cx *CompletionCtx) []mg.Completion

AppendSnippet is an alias of snippets.AppendSnippet

func BuildContext

func BuildContext(mx *mg.Ctx) *build.Context

BuildContext is an alias of goutil.BuildContext

func Dedent

func Dedent(s string) string

Dedent is an alias of goutil.Dedent

func DedentCompletion

func DedentCompletion(s string) string

DedentCompletion is an alias of goutil.DedentCompletion

func DeferSnippet

func DeferSnippet(cx *CompletionCtx) []mg.Completion

DeferSnippet is an alias of snippets.DeferSnippet

func DocSnippet

func DocSnippet(cx *CompletionCtx) []mg.Completion

DocSnippet is an alias of snippets.DocSnippet

func FuncSnippet

func FuncSnippet(cx *CompletionCtx) []mg.Completion

FuncSnippet is an alias of snippets.FuncSnippet

func GenDeclSnippet

func GenDeclSnippet(cx *CompletionCtx) []mg.Completion

GenDeclSnippet is an alias of snippets.GenDeclSnippet

func ImportPathSnippet

func ImportPathSnippet(cx *CompletionCtx) []mg.Completion

func InitFuncSnippet

func InitFuncSnippet(cx *CompletionCtx) []mg.Completion

InitFuncSnippet is an alias of snippets.InitFuncSnippet

func IsLetter

func IsLetter(ch rune) bool

IsLetter is an alias of goutil.IsLetter

func IsPkgDir

func IsPkgDir(dir string) bool

IsPkgDir is an alias of goutil.IsPkgDir

func MainFuncSnippet

func MainFuncSnippet(cx *CompletionCtx) []mg.Completion

MainFuncSnippet is an alias of snippets.MainFuncSnippet

func MapSnippet

func MapSnippet(cx *CompletionCtx) []mg.Completion

MapSnippet is an alias of snippets.MapSnippet

func MethodSnippet

func MethodSnippet(cx *CompletionCtx) []mg.Completion

MethodSnippet is an alias of snippets.MethodSnippet

func NodeEnclosesPos

func NodeEnclosesPos(node ast.Node, pos token.Pos) bool

NodeEnclosesPos is an alias of goutil.NodeEnclosesPos

func PackageNameSnippet

func PackageNameSnippet(cx *CompletionCtx) []mg.Completion

PackageNameSnippet is an alias of snippets.PackageNameSnippet

func PathList

func PathList(p string) []string

PathList is an alias of goutil.PathList

func TypeSnippet

func TypeSnippet(cx *CompletionCtx) []mg.Completion

TypeSnippet is an alias of snippets.TypeSnippet

Types

type AsmFmt

type AsmFmt struct{ mg.ReducerType }

AsmFmt is a reducer that does code fmt'ing for `.s` files. It uses the package https://github.com/klauspost/asmfmt

func (AsmFmt) Reduce

func (AsmFmt) Reduce(mx *mg.Ctx) *mg.State

type CompletionCtx

type CompletionCtx = CursorCtx

func NewCompletionCtx

func NewCompletionCtx(mx *mg.Ctx, src []byte, pos int) *CompletionCtx

NewCompletionCtx is an alias of cursor.NewCurCtx

type CompletionScope

type CompletionScope = CursorScope

type CursorCtx

type CursorCtx = cursor.CurCtx

func NewCursorCtx

func NewCursorCtx(mx *mg.Ctx, src []byte, pos int) *CursorCtx

NewCursorCtx is an alias of cursor.NewCurCtx

func NewViewCursorCtx

func NewViewCursorCtx(mx *mg.Ctx) *CursorCtx

NewViewCursorCtx is an alias of cursor.NewViewCurCtx

type CursorScope

type CursorScope = cursor.CurScope

type DocNode

type DocNode = cursor.DocNode

type FmtFunc

type FmtFunc func(mx *mg.Ctx, src []byte) ([]byte, error)

func (FmtFunc) Reduce

func (ff FmtFunc) Reduce(mx *mg.Ctx) *mg.State

type GoCmd

type GoCmd struct {
	mg.ReducerType

	Humanize bool
}

func (*GoCmd) Reduce

func (gc *GoCmd) Reduce(mx *mg.Ctx) *mg.State

type GoGenerate

type GoGenerate struct {
	mg.ReducerType

	// Args are extra arguments to pass to `go generate`
	Args []string
}

GoGenerate adds a UserCmd that calls `go generate` in go packages and sub-dirs

func (*GoGenerate) RCond

func (gg *GoGenerate) RCond(mx *mg.Ctx) bool

RCond implements mg.Reducer

func (*GoGenerate) Reduce

func (gg *GoGenerate) Reduce(mx *mg.Ctx) *mg.State

RCond implements mg.Reducer

type Gocode

type Gocode struct {
	mg.ReducerType

	AllowExplicitCompletions bool
	AllowWordCompletions     bool
	ShowFuncParams           bool
	ShowFuncResultNames      bool

	// Consider using MarGocodeCtl.Debug instead, it has more useful output
	Debug bool
	// This field is ignored, see MarGocodeCtl.ImporterMode
	Source bool
	// This field is ignored, see MarGocodeCtl.NoBuiltins
	ProposeBuiltins bool
	// This field is ignored, see MarGocodeCtl.ProposeTests
	ProposeTests bool
	// This field is ignored, see MarGocodeCtl.ImporterMode
	Autobuild bool
	// This field is ignored, See MarGocodeCtl.NoUnimportedPackages
	UnimportedPackages bool
	// contains filtered or unexported fields
}

func (*Gocode) RCond

func (g *Gocode) RCond(mx *mg.Ctx) bool

func (*Gocode) RConfig

func (g *Gocode) RConfig(mx *mg.Ctx) mg.EditorConfig

func (*Gocode) RMount

func (g *Gocode) RMount(mx *mg.Ctx)

func (*Gocode) RUnmount

func (g *Gocode) RUnmount(mx *mg.Ctx)

func (*Gocode) Reduce

func (g *Gocode) Reduce(mx *mg.Ctx) *mg.State

type GocodeCalltips

type GocodeCalltips struct {
	mg.ReducerType

	// This field is ignored, see MarGocodeCtl.ImporterMode
	Source bool
	// Consider using MarGocodeCtl.Debug instead, it has more useful output
	Debug bool
	// contains filtered or unexported fields
}

func (*GocodeCalltips) RCond

func (gc *GocodeCalltips) RCond(mx *mg.Ctx) bool

func (*GocodeCalltips) RMount

func (gc *GocodeCalltips) RMount(mx *mg.Ctx)

func (*GocodeCalltips) RUnmount

func (gc *GocodeCalltips) RUnmount(mx *mg.Ctx)

func (*GocodeCalltips) Reduce

func (gc *GocodeCalltips) Reduce(mx *mg.Ctx) *mg.State

type Guru

type Guru struct {
	mg.ReducerType
	// contains filtered or unexported fields
}

func (*Guru) RCond

func (g *Guru) RCond(mx *mg.Ctx) bool

func (*Guru) RMount

func (g *Guru) RMount(mx *mg.Ctx)

func (*Guru) Reduce

func (g *Guru) Reduce(mx *mg.Ctx) *mg.State

type ImporterMode

type ImporterMode int

ImporterMode specifies the mode in which the corresponding importer should operate

const (
	// KimPorter tells the importer to use Kim-Porter to import packages
	KimPorter ImporterMode = iota

	// SrcImporterOnly tells the importer use source only, with no fall-back
	SrcImporterOnly

	// BinImporterOnly tells the importer use binary packages only, with no fall-back
	BinImporterOnly

	// SrcImporterWithFallback tells the importer use source code, then fall-back to a binary package
	SrcImporterWithFallback
)

type Linter

type Linter struct {
	mg.Linter

	Actions []mg.Action

	Name string
	Args []string

	Tag     mg.IssueTag
	Label   string
	TempDir []string
}

Linter wraps mg.Linter to restrict its Langs to Go

all top-level fields are passed along to the underlying Linter

func GoInstall

func GoInstall(args ...string) *Linter

GoInstall returns a Linter that runs `go install args...`

func GoInstallDiscardBinaries

func GoInstallDiscardBinaries(args ...string) *Linter

GoInstallDiscardBinaries returns a Linter that runs `go install args...` it's like GoInstall, but additionally sets GOBIN to a temp directory resulting in all binaries being discarded

func GoTest

func GoTest(args ...string) *Linter

GoTest returns a Linter that runs `go test args...`

func GoVet

func GoVet(args ...string) *Linter

GoVet returns a Linter that runs `go vet args...`

func (*Linter) RCond

func (lt *Linter) RCond(mx *mg.Ctx) bool

RCond restricts reduction to Go files

func (*Linter) RInit

func (lt *Linter) RInit(mx *mg.Ctx)

RInit syncs top-level fields with the underlying Linter

type MarGocodeCtl

type MarGocodeCtl struct {
	mg.ReducerType

	// Whether or not to print debugging info related to the gocode cache
	// used by the Gocode and GocodeCalltips reducers
	Debug bool

	// DebugPrune returns true if pkg should be removed from the cache
	DebugPrune func(pkg *types.Package) bool

	// The mode in which the types.Importer shouler operate
	// By default it is SrcImporterWithFallback
	ImporterMode ImporterMode

	// Don't try to automatically import packages when auto-compeltion fails
	// e.g. when `json.` is typed, if auto-complete fails
	// "encoding/json" is imported and auto-complete attempted on that package instead
	// See AddUnimportedPackages
	NoUnimportedPackages bool

	// If a package was imported internally for use in auto-completion,
	// insert it in the source code
	// See NoUnimportedPackages
	// e.g. after `json.` is typed, `import "encoding/json"` added to the code
	AddUnimportedPackages bool

	// Don't preload packages to speed up auto-completion, etc.
	NoPreloading bool

	// Don't propose builtin types and functions
	NoBuiltins bool

	// Whether or not to propose builtin types and functions
	ProposeTests bool
}

func (*MarGocodeCtl) RInit

func (mgc *MarGocodeCtl) RInit(mx *mg.Ctx)

func (*MarGocodeCtl) Reduce

func (mgc *MarGocodeCtl) Reduce(mx *mg.Ctx) *mg.State

type ParsedFile

type ParsedFile = goutil.ParsedFile

func ParseFile

func ParseFile(mx *mg.Ctx, fn string, src []byte) *ParsedFile

ParseFile is an alias of goutil.ParseFile

func ParseFileWithMode

func ParseFileWithMode(mx *mg.Ctx, fn string, src []byte, mode parser.Mode) *ParsedFile

ParseFileWithMode is an alias of goutil.ParseFileWithMode

type PosEnd

type PosEnd = goutil.PosEnd

PosEnd is an alias of goutil.PosEnd

type ReleaseVersion

type ReleaseVersion = goutil.ReleaseVersion

type SnippetFunc

type SnippetFunc = snippets.SnippetFunc

SnippetFunc is an alias of snippets.SnippetFunc

type SnippetFuncsList

type SnippetFuncsList struct {
	mg.ReducerType
	Funcs []SnippetFunc
}

func SnippetFuncs

func SnippetFuncs(l ...SnippetFunc) *SnippetFuncsList

func (*SnippetFuncsList) RCond

func (sf *SnippetFuncsList) RCond(mx *mg.Ctx) bool

func (*SnippetFuncsList) Reduce

func (sf *SnippetFuncsList) Reduce(mx *mg.Ctx) *mg.State

type SyntaxCheck

type SyntaxCheck struct {
	mg.ReducerType
	// contains filtered or unexported fields
}

func (*SyntaxCheck) RCond

func (sc *SyntaxCheck) RCond(mx *mg.Ctx) bool

func (*SyntaxCheck) RMount

func (sc *SyntaxCheck) RMount(mx *mg.Ctx)

func (*SyntaxCheck) RUnmount

func (sc *SyntaxCheck) RUnmount(mx *mg.Ctx)

func (*SyntaxCheck) Reduce

func (sc *SyntaxCheck) Reduce(mx *mg.Ctx) *mg.State

type TestCmds

type TestCmds struct {
	mg.ReducerType

	// BenchArgs is a list of extra arguments to pass to `go test` for benchmarks
	// these are in addition to the usual `-test.run` and `-test.bench` args
	BenchArgs []string

	// TestArgs is a list of extra arguments to pass to `go test` for tests and examples
	// these are in addition to the usual `-test.run` arg
	TestArgs []string
}

func (*TestCmds) RCond

func (tc *TestCmds) RCond(mx *mg.Ctx) bool

func (*TestCmds) Reduce

func (tc *TestCmds) Reduce(mx *mg.Ctx) *mg.State

type TypeCheck

type TypeCheck struct {
	mg.ReducerType
	NoIssues  bool
	NoInfo    bool
	NoGotoDef bool
}

func (*TypeCheck) RInit

func (tc *TypeCheck) RInit(mx *mg.Ctx)

func (*TypeCheck) Reduce

func (tc *TypeCheck) Reduce(mx *mg.Ctx) *mg.State

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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