gocode

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCompleter = Completer{
	GocodePath: "gocode",
}

DefaultCompleter is a default Completer with gocode's path set to "gocode".

Functions

func Available

func Available() bool

Available checks if gocode executable is available or not.

Types

type Candidate

type Candidate struct {
	// One of "package", "func", "type", "var", "const".
	Class string `json:"class"`
	// The name of the candidate.
	Name string `json:"name"`
	// The type (in Go) of the candidate.
	Type string `json:"type"`
}

Candidate is resulting entries from gocode.

type Completer

type Completer struct {
	// The path to gocode
	GocodePath string
	// contains filtered or unexported fields
}

Completer is the interface to gocode that this package provides.

func (*Completer) Available

func (c *Completer) Available() bool

Available checks if gocode executable is available or not.

func (*Completer) Query

func (c *Completer) Query(source []byte, cursor int) (*Result, error)

Query asks gocode for completion of Go code source for a cursor position cursor.

type Result

type Result struct {
	// Cursor position within Candidates
	Cursor int
	// The list of Candidates
	Candidates []Candidate
}

Result represents a completion result of Query().

func Query

func Query(source []byte, cursor int) (*Result, error)

Query asks gocode for completion of Go code source for a cursor position cursor.

func (*Result) UnmarshalJSON

func (r *Result) UnmarshalJSON(text []byte) error

UnmarshalJSON decodes JSON bytes text to Result.

Jump to

Keyboard shortcuts

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