comp

package
v0.0.0-...-1adbf8b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldBeReplaced

func ShouldBeReplaced(e antlr.Tree) bool

ShouldBeReplaced defines whether element should be replaced or not.

Types

type AutoCompletion

type AutoCompletion struct {
	QueryBased  *QueryBased
	SchemaBased *SchemaBased
}

func NewAutoCompletion

func NewAutoCompletion(schema Metadata) *AutoCompletion

func (AutoCompletion) GetItems

func (a AutoCompletion) GetItems(types []types.Data, query antlr.Tree, filter string) (its []Item)

func (*AutoCompletion) UpdateReferenceProviders

func (a *AutoCompletion) UpdateReferenceProviders(refProvByCtx map[string]ref.Provider)

func (*AutoCompletion) UpdateSchema

func (a *AutoCompletion) UpdateSchema(schema Metadata)

type Cmd

type Cmd struct {
	Name    string
	Desc    string
	SubCmds []Cmd
}

Cmd represents a console command.

func (Cmd) String

func (c Cmd) String() string

String returns command name.

type Comp

type Comp interface {
	CalculateItems(ts types.Data, query antlr.Tree) []Item
	Complete(ts []types.Data, query antlr.Tree) (its []Item)
}

type Filter

type Filter struct {
	FilterText string
	Start      int
	Stop       int
}

Filter is used limit the replacement range in a longer input string.

func CalculateSmartReplaceRange

func CalculateSmartReplaceRange(e antlr.Tree, start, stop int) *Filter

type Info

type Info struct {
	Element antlr.Tree
	Query   antlr.Tree
	Found   bool
	Types   []types.Data
}

Info lists all completion types, which are allowed at a certain position.

func GetTypes

func GetTypes(e antlr.Tree) Info

GetTypes returns the completion types of the first Rule matching the given ParseTree.

type Item

type Item struct {
	Type    types.Type
	View    string
	Content string
	Postfix string
}

Item is completion candidate of a certain type.

func KeywordItems

func KeywordItems() []Item

KeywordItems lists all keywords as completion items.

func (Item) String

func (i Item) String() string

String returns a text representation of this completion item.

type ItemProvider

type ItemProvider func(schema Metadata, typeData types.Data) []Item

type LineCol

type LineCol struct {
	Line, Col int
}

LineCol represents the position of a character in a multi-line string.

func (LineCol) String

func (l LineCol) String() string

String returns "(line,column)".

type Metadata

type Metadata struct {
	meta.Schema
	Params  []string
	ConCmds []Cmd
}

Metadata represents holds schema information and other completion metadata.

type QueryBased

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

QueryBased completion provides Items based on the input text.

func NewQueryBased

func NewQueryBased(refProvByCtx map[string]ref.Provider) *QueryBased

NewQueryBased creates a new QueryBased completer using the given Providers.

func (QueryBased) CalculateItems

func (q QueryBased) CalculateItems(t types.Data, query antlr.Tree) (its []Item)

CalculateItems returns all variables from the entire CypherQueryContext.

func (QueryBased) Complete

func (q QueryBased) Complete(ts []types.Data, query antlr.Tree) (its []Item)

Complete returns all variables from the entire CypherQueryContext.

type Range

type Range struct {
	From, To LineCol
}

Range represents the position range of a substring in a multi-line string.

func (Range) String

func (r Range) String() string

String returns "[(fromLine,fromColumn),(toLine,toColumn)]".

type Result

type Result struct {
	Items []Item
	Range Range
}

Result holds the completion candidates and their insert position.

type SchemaBased

type SchemaBased struct {
	Schema Metadata
	// contains filtered or unexported fields
}

func NewSchemaBased

func NewSchemaBased(schema Metadata) *SchemaBased

func (SchemaBased) CalculateItems

func (s SchemaBased) CalculateItems(t types.Data, _ antlr.Tree) (its []Item)

func (SchemaBased) Complete

func (s SchemaBased) Complete(ts []types.Data, query antlr.Tree) (its []Item)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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