Skip to content

Conversation

@juleswritescode
Copy link
Collaborator

@juleswritescode juleswritescode commented Oct 28, 2025

  • introduces a couple of new leaf-identifier nodes: role_identifier, table_identifier and so on
  • introduces a couple of new referenves next to the old object_reference, e.g. table_reference or function_reference.
  • adds queryable tags to the fields of the references and refactors the tree-sitter queries to use them

Notice that we can only use precise leaf-identifiers if we have a fully qualified *_reference:

In an incomplete statement, if a user writes select us| from some_table;, the us could be either a schema, a table, an alias, or a column. The user is still writing the query; we don't know what he'll type next!

Even if he writes select something.us|, something might refer to a table, alias or schema; us might refer to a table or column.

Only when he writes select something.users.email do we know which part is a schema, which a table, and which a column.

The tags on the *_reference should help us decide which data types to consider for completion/hover.


In the next PRs, I want to store relevant parent nodes and field names. Right now, we're traversing the tree alot, for example to find out if a node has a certain tag or if the ancestory history matches a template. We can make this easier and faster by collecting the traversed nodes/fields in some kind of data structure and checking against that.

@juleswritescode juleswritescode changed the base branch from main to refactor/identifier-qualifiers November 1, 2025 15:37
@juleswritescode juleswritescode marked this pull request as ready for review November 1, 2025 15:38
@juleswritescode juleswritescode changed the title refactor: tree-sitter object reference refactor: use more specific tree-sitter references and identifiers Nov 1, 2025
@juleswritescode juleswritescode changed the title refactor: use more specific tree-sitter references and identifiers [2] refactor: use more specific tree-sitter references and identifiers Nov 1, 2025
Base automatically changed from refactor/identifier-qualifiers to refactor/node-identification-tuples November 2, 2025 07:46
@juleswritescode juleswritescode merged commit 7da2494 into refactor/node-identification-tuples Nov 7, 2025
8 checks passed
@juleswritescode juleswritescode deleted the refactor/object-reference branch November 7, 2025 11:00
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.

3 participants