Documentation ¶
Index ¶
- func SetLogger(l *zap.Logger)
- func SetRoot(root string)
- type CompletionItem
- type CompletionItemInsertTextRule
- type CompletionItemKind
- type MarkdownString
- type Package
- func (p *Package) AllSymbols() []*CompletionItem
- func (p *Package) Analyze() (err error)
- func (p *Package) GetCompletionItem() *CompletionItem
- func (p *Package) GetLocation() string
- func (p *Package) HasChildren() bool
- func (p *Package) IsBuiltin() bool
- func (p *Package) SymbolByChar(chr string) []*CompletionItem
- type PackageIndex
- type PackageScanner
- type PackageSummary
- type Packages
- type SymbolIndex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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 ¶
ReadPackagesFile reads and loads packages list from packages.json file
func (*Package) AllSymbols ¶
func (p *Package) AllSymbols() []*CompletionItem
AllSymbols returns all symbols
func (*Package) Analyze ¶
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 ¶
GetLocation returns absolute package location on disk
func (*Package) HasChildren ¶
HasChildren returns if package has sub-packages
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) 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 ¶
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) 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