Skip to content

Commit 019a3bc

Browse files
ok
1 parent 5f8e7b3 commit 019a3bc

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

crates/pgt_completions/src/relevance/filtering.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ impl CompletionFilter<'_> {
9999
CompletionRelevanceData::Table(_) => match clause {
100100
WrappingClause::From | WrappingClause::Update => true,
101101

102+
WrappingClause::RevokeStatement => {
103+
ctx.matches_ancestor_history(&["revoke_on_table", "object_reference"])
104+
}
105+
102106
WrappingClause::Join { on_node: None } => true,
103107
WrappingClause::Join { on_node: Some(on) } => ctx
104108
.node_under_cursor
@@ -202,6 +206,12 @@ impl CompletionFilter<'_> {
202206
| WrappingClause::Update
203207
| WrappingClause::Delete => true,
204208

209+
WrappingClause::RevokeStatement => {
210+
(ctx.matches_ancestor_history(&["revoke_on_table", "object_reference"])
211+
&& ctx.schema_or_alias_name.is_none())
212+
|| ctx.matches_ancestor_history(&["revoke_on_all"])
213+
}
214+
205215
WrappingClause::Where => {
206216
ctx.before_cursor_matches_kind(&["keyword_and", "keyword_where"])
207217
}

crates/pgt_hover/src/hovered_node.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ impl HoveredNode {
3232
let under_cursor = ctx.node_under_cursor.as_ref()?;
3333

3434
match under_cursor.kind() {
35-
"identifier" if ctx.matches_ancestor_history(&["relation", "object_reference"]) => {
35+
"identifier"
36+
if ctx.matches_ancestor_history(&["relation", "object_reference"])
37+
|| ctx.matches_ancestor_history(&["revoke_on_table", "object_reference"]) =>
38+
{
3639
let num_sibs = ctx.num_siblings();
3740
if ctx.node_under_cursor_is_nth_child(1) && num_sibs > 0 {
3841
return Some(HoveredNode::Schema(NodeIdentification::Name(node_content)));

0 commit comments

Comments
 (0)