MCPcopy Index your code
hub / github.com/bytebase/bytebase / newCompleter

Function newCompleter

backend/plugin/parser/plsql/completion.go:68–83  ·  view source on GitHub ↗
(ctx context.Context, cCtx base.CompletionContext, sql string, byteOffset int)

Source from the content-addressed store, hash-verified

66}
67
68func newCompleter(ctx context.Context, cCtx base.CompletionContext, sql string, byteOffset int) *Completer {
69 tokens := oracleparser.Tokenize(sql)
70 return &Completer{
71 ctx: ctx,
72 scene: cCtx.Scene,
73 sql: sql,
74 cursorByteOffset: byteOffset,
75 tokens: tokens,
76 caretTokenIndex: findCaretTokenIndex(tokens, byteOffset),
77 instanceID: cCtx.InstanceID,
78 getMetadata: cCtx.Metadata,
79 listDatabaseNames: cCtx.ListDatabaseNames,
80 defaultDatabase: cCtx.DefaultDatabase,
81 metadataCache: make(map[string]*model.DatabaseMetadata),
82 }
83}
84
85func computeSQLAndByteOffset(statement string, caretLine int, caretOffset int, tricky bool) (string, int) {
86 sql, newLine, newOffset := skipHeadingSQLs(statement, caretLine, caretOffset)

Callers 2

NewStandardCompleterFunction · 0.70
NewTrickyCompleterFunction · 0.70

Calls 1

findCaretTokenIndexFunction · 0.70

Tested by

no test coverage detected