analyzer

package
Version: v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l *zap.Logger)

SetLogger sets logger

func SetRoot

func SetRoot(root string)

SetRoot sets GOROOT

Types

type CompletionItem

type CompletionItem struct {
	// Label is item label
	Label string `json:"label"`
	// Kind is item kind
	Kind CompletionItemKind `json:"kind"`
	// Detail is item description
	Detail string `json:"detail"`
	// Documentation is string or MarkdownString doc string
	Documentation interface{} `json:"documentation"`
	// InsertText is text to be inserted
	InsertText string `json:"insertText"`
	// InsertTextRules is a string or snippet that should be inserted in a document
	// when selecting this completion. When `falsy` the label in used.
	InsertTextRules CompletionItemInsertTextRule `json:"insertTextRules,omitempty"`
}

CompletionItem is monaco-editor binding

type CompletionItemInsertTextRule added in v1.6.0

type CompletionItemInsertTextRule int

CompletionItemInsertTextRule is insert text insert rule.

const (
	// KeepWhitespace is adjust whitespace/indentation of
	// multiline insert texts to match the current line indentation.
	KeepWhitespace CompletionItemInsertTextRule = 1

	// InsertAsSnippet means that `insertText` is a snippet.
	InsertAsSnippet CompletionItemInsertTextRule = 4
)

type CompletionItemKind

type CompletionItemKind int

CompletionItemKind is monaco-editor binding

const (
	Method CompletionItemKind = iota
	Function
	Constructor
	Field
	Variable
	Class
	Struct
	Interface
	Module
	Property
	Event
	Operator
	Unit
	Value
	Constant
	Enum
	EnumMember
	Keyword
	Text
	Color
	File
	Reference
	Customcolor
	Folder
	TypeParameter
	Snippet
)

type MarkdownString

type MarkdownString struct {
	// Value is string contents
	Value string `json:"value"`
}

MarkdownString is monaco-editor string with markdown

func NewMarkdownString added in v1.5.1

func NewMarkdownString(val string) MarkdownString

NewMarkdownString returns markdown string

type Package

type Package struct {
	// Name is package name
	Name string `json:"name"`
	// Synopsis is package description
	Synopsis string `json:"synopsis"`
	// URL is godoc URL
	URL string `json:"url"`
	// Path is package import path
	Path string `json:"path"`
	// Children is list of sub-packages
	Children []*Package `json:"children"`
	PackageSummary
	// contains filtered or unexported fields
}

Package is Go package metadata

func ReadPackagesFile

func ReadPackagesFile(f string) ([]*Package, error)

ReadPackagesFile reads and loads packages list from packages.json file

func (*Package) AllSymbols added in v1.5.0

func (p *Package) AllSymbols() []*CompletionItem

AllSymbols returns all symbols

func (*Package) Analyze

func (p *Package) Analyze() (err error)

Analyze performs package analysis from sources on disk

This is one time operation

func (*Package) GetCompletionItem

func (p *Package) GetCompletionItem() *CompletionItem

GetCompletionItem returns package symbol

func (*Package) GetLocation

func (p *Package) GetLocation() string

GetLocation returns absolute package location on disk

func (*Package) HasChildren

func (p *Package) HasChildren() bool

HasChildren returns if package has sub-packages

func (*Package) IsBuiltin

func (p *Package) IsBuiltin() bool

IsBuiltin check if this is "builtin" special package

func (*Package) SymbolByChar

func (p *Package) SymbolByChar(chr string) []*CompletionItem

SymbolByChar returns list of symbols by first char

type PackageIndex

type PackageIndex struct {
	// Packages is list of packages
	Packages []*Package
	// contains filtered or unexported fields
}

PackageIndex is Go packages index

func BuildPackageIndex

func BuildPackageIndex(pkgs []*Package) PackageIndex

BuildPackageIndex builds package index from set of packages

func (PackageIndex) Len

func (pi PackageIndex) Len() int

Len returns index length

func (PackageIndex) Match

func (pi PackageIndex) Match(char string) []*CompletionItem

Match returns code completion suggestions by character

func (PackageIndex) PackageByName

func (pi PackageIndex) PackageByName(name string) (*Package, bool)

PackageByName returns package by name

type PackageScanner

type PackageScanner struct {
	// contains filtered or unexported fields
}

PackageScanner is package source files scanner

func NewPackageScanner

func NewPackageScanner(pkgName, pkgPath string, scanPrivate bool) PackageScanner

NewPackageScanner is PackageScanner constructor

func (*PackageScanner) Scan

func (p *PackageScanner) Scan() (PackageSummary, error)

Scan performs source files scan

type PackageSummary

type PackageSummary struct {
	// Functions is index of functions
	Functions SymbolIndex
	// Values is index of other symbolx
	Values SymbolIndex
}

PackageSummary is package contents summary

func NewPackageSummary

func NewPackageSummary() PackageSummary

NewPackageSummary is PackageSummary constructor

type Packages

type Packages []*Package

Packages is list of packages

func (Packages) GetCompletionItems

func (pkgs Packages) GetCompletionItems() []*CompletionItem

GetCompletionItems returns all symbols from packages

type SymbolIndex

type SymbolIndex struct {
	Symbols []*CompletionItem
	// contains filtered or unexported fields
}

SymbolIndex is Go symbols index

func NewSymbolIndex added in v1.6.2

func NewSymbolIndex(items []*CompletionItem) SymbolIndex

NewSymbolIndex creates a new symbol index from completion items

func (*SymbolIndex) Append

func (si *SymbolIndex) Append(items ...*CompletionItem)

Append appends symbols to index

func (*SymbolIndex) Len added in v1.5.0

func (si *SymbolIndex) Len() int

Len returns symbols length

func (SymbolIndex) Match

func (si SymbolIndex) Match(char string) []*CompletionItem

Match matches symbols by prefix char

func (SymbolIndex) SymbolByName

func (si SymbolIndex) SymbolByName(name string) *CompletionItem

SymbolByName returns symbol by name

Directories

Path Synopsis
Package check checks provided Go code and reports syntax errors
Package check checks provided Go code and reports syntax errors

Jump to

Keyboard shortcuts

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