test: verify all keywords of grammar are available in completions#701
test: verify all keywords of grammar are available in completions#701juleswritescode merged 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
these keywords were unreachable 👍🏻
psteinroe
left a comment
There was a problem hiding this comment.
the KW list from postgres includes a keyword type to differentiate btw reserved and non-reserved keywords. did u check if the list we want here could be generated from that?
Yeah I did check it, but the issue is that we have some completable "keywords" that aren't even tokens in the Postgres protobuf. For example, for So our "keyword completion" is actually more a "valid token at this position" completion. |
Adds two tests that make sure:
grammar.jsare included in the keyword-providersgrammar.jsI tried generating the tests from the
pg_query.protofirst, but some tokens such as "btree" and "gin" are no "official postgres keywords" — we do want to suggest them as keywords at the right spots, though.Regarding keyword generation: I think generating the keywords from either protobuf or treesitter-grammar doesn't really make sense: We have the
.starts_statement()and.require_prefix()builder pattern, and I figure there'll be more of those options soon; so we'd need some manual code anyways.