You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `pg_completions` identifies and ranks autocompletion items that can be displayed in your code editor.
6
+
Its main export is the `complete` function. The function takes a PostgreSQL statement, a cursor position, and a datastructure representing the underlying databases schema. It returns a list of completion items.
7
+
8
+
Postgres's statement-parsing-engine, `libpg_query`, which is used in other parts of this LSP, is only capable of parsing _complete and valid_ statements. Since autocompletion should work for incomplete statements, we rely heavily on tree-sitter – an incremental parsing library.
9
+
10
+
### Working with TreeSitter
11
+
12
+
In the `pg_test_utils` crate, there's a binary that parses an SQL file and prints out the matching tree-sitter tree.
13
+
This makes writing tree-sitter queries for this crate easy.
14
+
15
+
To print a tree, run `cargo run --bin tree_print -- -f <your_sql_file>`.
0 commit comments