Skip to content

Commit 7a205d1

Browse files
so far so good
1 parent 2eca24d commit 7a205d1

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

crates/pgt_hover/src/hovered_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl HoveredNode {
7373
}
7474
}
7575

76-
"any_identifier" if ctx.matches_ancestor_history(&["field"]) => {
76+
"column_identifier" => {
7777
if let Some(table_or_alias) = ctx.schema_or_alias_name.as_ref() {
7878
Some(HoveredNode::Column(NodeIdentification::SchemaAndName((
7979
table_or_alias.clone(),

crates/pgt_treesitter/src/queries/parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1111
[
1212
(field
1313
(field_qualifier)?
14-
(any_identifier)
14+
(column_identifier)
1515
) @reference
1616
1717
(parameter) @parameter

crates/pgt_treesitter/src/queries/select_columns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1414
(object_reference) @alias
1515
"."
1616
)?
17-
(any_identifier) @column
17+
(column_identifier) @column
1818
)
1919
)
2020
","?

crates/pgt_treesitter/src/queries/where_columns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1616
(object_reference) @alias
1717
"."
1818
)?
19-
(any_identifier) @column
19+
(column_identifier) @column
2020
)
2121
)
2222
)

crates/pgt_treesitter_grammar/grammar.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = grammar({
2828
[$.time],
2929
[$.timestamp],
3030
[$.grantable_on_function, $.grantable_on_table],
31+
[$.any_identifier, $.column_identifier],
3132
],
3233

3334
precedences: ($) => [
@@ -779,21 +780,7 @@ module.exports = grammar({
779780
),
780781

781782
_show_statement: ($) =>
782-
seq(
783-
$.keyword_show,
784-
choice(
785-
$._show_create,
786-
$.keyword_all, // Postgres
787-
$._show_tables // trino/presto
788-
)
789-
),
790-
791-
_show_tables: ($) =>
792-
seq(
793-
$.keyword_tables,
794-
optional(seq($.keyword_from, $._qualified_field)),
795-
optional(seq($.keyword_like, $._expression))
796-
),
783+
seq($.keyword_show, choice($._show_create, $.keyword_all)),
797784

798785
_show_create: ($) =>
799786
seq(
@@ -2363,7 +2350,7 @@ module.exports = grammar({
23632350

23642351
_column_list: ($) => paren_list(alias($._column, $.column), true),
23652352
_column: ($) =>
2366-
choice($.any_identifier, alias($._literal_string, $.literal)),
2353+
choice($.column_identifier, alias($._literal_string, $.literal)),
23672354

23682355
_update_statement: ($) => seq($.update, optional($.returning)),
23692356

@@ -2834,10 +2821,10 @@ module.exports = grammar({
28342821
$.keyword_end
28352822
),
28362823

2837-
field: ($) => field("name", $.any_identifier),
2824+
field: ($) => field("name", $.column_identifier),
28382825

28392826
_qualified_field: ($) =>
2840-
seq(optional($.field_qualifier), field("name", $.any_identifier)),
2827+
seq(optional($.field_qualifier), $.column_identifier),
28412828

28422829
field_qualifier: ($) =>
28432830
seq(prec.left(optional_parenthesis($.object_reference)), "."),
@@ -3531,6 +3518,8 @@ module.exports = grammar({
35313518
bang: (_) => "!",
35323519

35333520
any_identifier: ($) => $._any_identifier,
3521+
column_identifier: ($) => $._any_identifier,
3522+
35343523
_any_identifier: ($) =>
35353524
choice(
35363525
$._identifier,

0 commit comments

Comments
 (0)