Skip to content

feat(completions): basic scoring algorithm for tables #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

juleswritescode
Copy link
Collaborator

@juleswritescode juleswritescode commented Dec 1, 2024

This PR tries to improve the existing pg_completions crate – autocompletions!

The goal was to autocomplete table names based on the input:

  1. select * from us should put the users table before the emails table
  2. select * from private.u should put the private.uncommon before the public.users table

And whoopdidoopdie, it works.

An overview of the changes:

  • Separated the types into Builder & Context as well as CompletionItem + CompletionRelevance to rank them (stolen from rust-analyzer)
  • Removed some unnecessary lifetimes
  • The CompletionBuilder now returns the tower_lsp::CompletionItem data structure
  • Added some integation tests
  • Made sure all crates use the workspace's tower-lsp version
  • Added a small README.md to the pg_completions crate
  • Added a small script that prints the tree-sitter tree of an sql file

@juleswritescode juleswritescode marked this pull request as ready for review December 8, 2024 15:59
Copy link
Collaborator

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

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

very nice! just one thing about the api boundary. thanks for doing this!!

Copy link
Collaborator

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for working on the feedback!

@psteinroe psteinroe merged commit b356e92 into supabase-community:main Dec 11, 2024
1 check passed
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