Completion is the entry point of PostgreSQL code completion.
(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int)
| 25 | |
| 26 | // Completion is the entry point of PostgreSQL code completion. |
| 27 | func 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. |
nothing calls this directly
no test coverage detected