suggest

package
v0.0.0-...-a1431e3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: MIT Imports: 14 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Formatters = map[string]Formatter{
	"csv":              csvFormat,
	"csv-with-package": csvFormat,
	"emacs":            emacsFormat,
	"godit":            goditFormat,
	"json":             jsonFormat,
	"nice":             NiceFormat,
	"vim":              vimFormat,
}

Functions

func NiceFormat

func NiceFormat(w io.Writer, candidates []Candidate, num int)

Types

type Candidate

type Candidate struct {
	Class   string `json:"class"`
	PkgPath string `json:"package"`
	Name    string `json:"name"`
	Type    string `json:"type"`
}

func (Candidate) String

func (c Candidate) String() string

func (Candidate) Suggestion

func (c Candidate) Suggestion() string

type Config

type Config struct {
	Importer   types.Importer
	Logf       func(fmt string, args ...interface{})
	Builtin    bool
	IgnoreCase bool

	// UnimportedPackage returns a package with name pkgName.
	// It's used as a resort for unknown selector types like `fmt` in `fmt.`
	// when the corresponding package has not been imported
	UnimportedPackage func(pkgName string) *types.Package
}

func (*Config) Suggest

func (c *Config) Suggest(filename string, data []byte, cursor int) ([]Candidate, int)

Suggest returns a list of suggestion candidates and the length of the text that should be replaced, if any.

type Formatter

type Formatter func(w io.Writer, candidates []Candidate, num int)

Jump to

Keyboard shortcuts

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