Skip to content

Commit 05ad286

Browse files
fix final stuff
1 parent d4df303 commit 05ad286

File tree

6 files changed

+315222
-309385
lines changed

6 files changed

+315222
-309385
lines changed

crates/pgls_hover/src/hovered_node.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,19 @@ impl HoveredNode {
118118

119119
// hover over type in `select` clause etc…
120120
|| (ctx
121-
.matches_ancestor_history(&["field_qualifier", "object_reference"])
122-
&& ctx.before_cursor_matches_kind(&["("])))
121+
.matches_ancestor_history(&["field_selection","composite_reference","object_reference"])
122+
&& ctx.node_under_cursor_is_within_field_name(&["object_reference_1of1", "object_reference_2of2"])))
123123

124124
// make sure we're not checking against an alias
125125
&& ctx
126126
.get_mentioned_table_for_alias(
127-
node_content.replace(['(', ')'], "").as_str(),
127+
node_content.as_str(),
128128
)
129129
.is_none() =>
130130
{
131-
let sanitized = node_content.replace(['(', ')'], "");
132-
133131
Some(HoveredNode::PostgresType((
134132
ctx.identifier_qualifiers.1.clone(),
135-
sanitized,
133+
node_content,
136134
)))
137135
}
138136

crates/pgls_treesitter_grammar/grammar.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3008,7 +3008,7 @@ module.exports = grammar({
30083008
grantables: ($) =>
30093009
choice(
30103010
seq(
3011-
seq($._grantable, comma_list($.column_identifier, false)),
3011+
seq($.grantable, comma_list($.column_identifier, false)),
30123012
choice(
30133013
$.grantable_on_table,
30143014
$.grantable_on_function,
@@ -3018,7 +3018,7 @@ module.exports = grammar({
30183018
comma_list($.role_identifier, true)
30193019
),
30203020

3021-
_grantable: ($) =>
3021+
grantable: ($) =>
30223022
choice(
30233023
comma_list(
30243024
choice(
@@ -3041,9 +3041,7 @@ module.exports = grammar({
30413041
grantable_on_function: ($) =>
30423042
seq(
30433043
$.keyword_on,
3044-
optional(
3045-
choice($.keyword_function, $.keyword_procedure, $.keyword_routine)
3046-
),
3044+
choice($.keyword_function, $.keyword_procedure, $.keyword_routine),
30473045
comma_list(
30483046
seq($.function_reference, optional($.function_arguments)),
30493047
true
@@ -3105,11 +3103,22 @@ module.exports = grammar({
31053103
$.array,
31063104
$.interval,
31073105
$.between_expression,
3106+
$.field_selection,
31083107
$.parenthesized_expression,
31093108
$.object_id
31103109
)
31113110
),
31123111

3112+
field_selection: ($) =>
3113+
seq(
3114+
choice($.composite_reference, $.parenthesized_expression),
3115+
".",
3116+
$.any_identifier
3117+
),
3118+
3119+
composite_reference: ($) =>
3120+
prec(3, wrapped_in_parenthesis($.object_reference)),
3121+
31133122
parenthesized_expression: ($) =>
31143123
prec(2, wrapped_in_parenthesis($._expression)),
31153124

crates/pgls_treesitter_grammar/src/grammar.json

Lines changed: 61 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)