Skip to content

Feat/basic auto completion - #40

Merged
balajz merged 3 commits into
mainfrom
feat/basic-auto-completion
Apr 22, 2026
Merged

Feat/basic auto completion#40
balajz merged 3 commits into
mainfrom
feat/basic-auto-completion

Conversation

@balajz

@balajz balajz commented Apr 22, 2026

Copy link
Copy Markdown
Owner

No description provided.

balajz added 3 commits April 22, 2026 06:10
Signed-off-by: Balaji J <j.balaji2468@gmail.com>
Signed-off-by: Balaji J <j.balaji2468@gmail.com>
Signed-off-by: Balaji J <j.balaji2468@gmail.com>
Copilot AI review requested due to automatic review settings April 22, 2026 01:06
@balajz
balajz merged commit 52bedf7 into main Apr 22, 2026
5 checks passed
@balajz
balajz deleted the feat/basic-auto-completion branch April 22, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds basic SQL keyword autocompletion to the interactive prompt by embedding a PostgreSQL keyword list and wiring it into the prompt reader during CLI initialization.

Changes:

  • Replace the previous embedded JSON literals blob with an embedded plain-text PostgreSQL keyword list.
  • Load keywords at CLI startup and configure the prompt’s autocompleter with those suggestions.
  • Rename the app constructor (NewPgxCLINew) and bump go-prompter to a newer pseudo-version to support the new completion API.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/parser/pgliterals.json Removes the old embedded JSON literal dataset (keywords/functions/datatypes/reserved).
internal/parser/pgliterals.go Removes JSON embedding + parsing helpers for PG literals.
internal/parser/pg_kw.txt Adds embedded plain-text PostgreSQL keyword list used for completion.
internal/parser/pg_kw.go Adds loader that parses the embedded keyword file into a suggestion slice.
internal/parser/pg_kw_test.go Adds a unit test asserting keyword list loads and contains common commands.
internal/cli/root.go Loads PG keywords during startup and injects them into the app as autocompletion suggestions.
internal/app/reader.go Extends the Reader interface and configures go-prompter autocompletion from keyword suggestions.
internal/app/app.go Renames constructor to New and adds SetAutocompleter passthrough to the reader.
go.mod Updates github.com/jedib0t/go-prompter version to support new completion methods.
go.sum Updates checksums for the new go-prompter version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/app/reader.go
Comment on lines +52 to +58
func (r *PgxReader) SetAutocompleter(keywords []string) {
suggestions := make([]prompt.Suggestion, len(keywords))
for i, kw := range keywords {
suggestions[i] = prompt.Suggestion{Value: kw}
}
r.prompt.SetAutoCompleterContextual(prompt.AutoCompleteSimple(suggestions, true))
}

Copilot AI Apr 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetAutocompleter introduces new interactive behavior, but there’s no unit test verifying that the prompter’s autocompleter is actually configured (e.g., that SetAutoCompleterContextual is invoked with a non-nil completer and the expected suggestion values). Consider adding a small test using a stub/mock prompt.Prompter to prevent regressions when upgrading go-prompter or refactoring the reader.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants