MCPcopy Create free account
hub / github.com/bytebase/bytebase / Completion

Function Completion

backend/plugin/parser/pg/completion.go:27–39  ·  view source on GitHub ↗

Completion is the entry point of PostgreSQL code completion.

(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int)

Source from the content-addressed store, hash-verified

25
26// Completion is the entry point of PostgreSQL code completion.
27func Completion(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int) ([]base.Candidate, error) {
28 completer := NewStandardCompleter(ctx, cCtx, statement, caretLine, caretOffset)
29 result, err := completer.completion()
30 if err != nil {
31 return nil, err
32 }
33 if len(result) > 0 {
34 return result, nil
35 }
36
37 trickyCompleter := NewTrickyCompleter(ctx, cCtx, statement, caretLine, caretOffset)
38 return trickyCompleter.completion()
39}
40
41// computeSQLAndByteOffset converts (statement, caretLine, caretOffset) to
42// (trimmedSQL, byteOffset) for omni's parser.Collect API.

Callers

nothing calls this directly

Calls 3

NewStandardCompleterFunction · 0.70
NewTrickyCompleterFunction · 0.70
completionMethod · 0.45

Tested by

no test coverage detected