Documentation
¶
Overview ¶
Package complete turns a caret position into completion candidates.
The engine is pure logic over a Catalog lookup, so the interesting part — which names belong at which position — is tested without a database or a terminal.
Index ¶
Constants ¶
const MaxCandidates = 200
MaxCandidates bounds the popup. A schema with thousands of tables would otherwise produce a list nobody can navigate.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
Text string
Kind Kind
Detail string
// ReplaceFrom and ReplaceTo delimit what accepting this candidate
// overwrites, so the editor does not have to work it out again.
ReplaceFrom, ReplaceTo int
}
Candidate is one suggestion, together with the text it replaces.
type Catalog ¶
type Catalog interface {
Schemas(ctx context.Context, datasource string) ([]string, error)
Tables(ctx context.Context, datasource, schema string) ([]string, error)
Columns(ctx context.Context, datasource, schema, table string) ([]string, error)
}
Catalog is the metadata source. It is an interface so the engine can be tested without SQLite, and so a cold cache is just an empty answer.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine produces candidates for one datasource.
func (*Engine) SetSchema ¶
SetSchema changes the schema unqualified names resolve against, which follows the tree selection and any USE statement.