@@ -4,14 +4,11 @@ use std::{
44} ;
55mod base_parser;
66mod grant_parser;
7- mod revoke_parser;
87
98use crate :: queries:: { self , QueryResult , TreeSitterQueriesExecutor } ;
109use pgt_text_size:: { TextRange , TextSize } ;
1110
12- use crate :: context:: {
13- base_parser:: CompletionStatementParser , grant_parser:: GrantParser , revoke_parser:: RevokeParser ,
14- } ;
11+ use crate :: context:: { base_parser:: CompletionStatementParser , grant_parser:: GrantParser } ;
1512
1613#[ derive( Debug , PartialEq , Eq , Hash , Clone ) ]
1714pub enum WrappingClause < ' a > {
@@ -34,6 +31,7 @@ pub enum WrappingClause<'a> {
3431 SetStatement ,
3532 AlterRole ,
3633 DropRole ,
34+ RevokeStatement ,
3735
3836 CreatePolicy ,
3937 AlterPolicy ,
@@ -198,8 +196,6 @@ impl<'a> TreesitterContext<'a> {
198196
199197 if GrantParser :: looks_like_matching_stmt ( params. text ) {
200198 ctx. gather_grant_context ( ) ;
201- } else if RevokeParser :: looks_like_matching_stmt ( params. text ) {
202- ctx. gather_revoke_context ( ) ;
203199 } else {
204200 ctx. gather_tree_context ( ) ;
205201 ctx. gather_info_from_ts_queries ( ) ;
@@ -208,34 +204,6 @@ impl<'a> TreesitterContext<'a> {
208204 ctx
209205 }
210206
211- fn gather_revoke_context ( & mut self ) {
212- let revoke_context = RevokeParser :: get_context ( self . text , self . position ) ;
213-
214- self . node_under_cursor = Some ( NodeUnderCursor :: CustomNode {
215- text : revoke_context. node_text ,
216- range : revoke_context. node_range ,
217- kind : revoke_context. node_kind . clone ( ) ,
218- previous_node_kind : None ,
219- } ) ;
220-
221- if revoke_context. node_kind == "revoke_table" {
222- self . schema_or_alias_name = revoke_context. schema_name . clone ( ) ;
223- }
224-
225- if revoke_context. table_name . is_some ( ) {
226- let mut new = HashSet :: new ( ) ;
227- new. insert ( revoke_context. table_name . unwrap ( ) ) ;
228- self . mentioned_relations
229- . insert ( revoke_context. schema_name , new) ;
230- }
231-
232- self . wrapping_clause_type = match revoke_context. node_kind . as_str ( ) {
233- "revoke_role" => Some ( WrappingClause :: ToRoleAssignment ) ,
234- "revoke_table" => Some ( WrappingClause :: From ) ,
235- _ => None ,
236- } ;
237- }
238-
239207 fn gather_grant_context ( & mut self ) {
240208 let grant_context = GrantParser :: get_context ( self . text , self . position ) ;
241209
@@ -686,6 +654,7 @@ impl<'a> TreesitterContext<'a> {
686654 "rename_column" => Some ( WrappingClause :: RenameColumn ) ,
687655 "alter_table" => Some ( WrappingClause :: AlterTable ) ,
688656 "set_statement" => Some ( WrappingClause :: SetStatement ) ,
657+ "revoke_statement" => Some ( WrappingClause :: RevokeStatement ) ,
689658 "column_definitions" => Some ( WrappingClause :: ColumnDefinitions ) ,
690659 "create_policy" => Some ( WrappingClause :: CreatePolicy ) ,
691660 "alter_policy" => Some ( WrappingClause :: AlterPolicy ) ,
0 commit comments