@@ -6,8 +6,8 @@ use crate::{
66 builder:: CompletionBuilder ,
77 item:: CompletionItem ,
88 providers:: {
9- complete_columns, complete_functions, complete_policies , complete_roles , complete_schemas ,
10- complete_tables,
9+ complete_columns, complete_functions, complete_keywords , complete_policies , complete_roles ,
10+ complete_schemas , complete_tables,
1111 } ,
1212 sanitization:: SanitizedCompletionParams ,
1313} ;
@@ -27,6 +27,13 @@ pub struct CompletionParams<'a> {
2727 position = params. position. to_string( )
2828) ) ]
2929pub fn complete ( params : CompletionParams ) -> Vec < CompletionItem > {
30+ let uses_upper_case = params
31+ . text
32+ . split_ascii_whitespace ( )
33+ // filter out special chars and numbers
34+ . filter ( |word| word. chars ( ) . all ( |c| c. is_alphabetic ( ) ) )
35+ . any ( |t| t == t. to_ascii_uppercase ( ) ) ;
36+
3037 let sanitized_params = SanitizedCompletionParams :: from ( params) ;
3138
3239 let ctx = TreesitterContext :: new ( TreeSitterContextParams {
@@ -43,6 +50,7 @@ pub fn complete(params: CompletionParams) -> Vec<CompletionItem> {
4350 complete_schemas ( & ctx, sanitized_params. schema , & mut builder) ;
4451 complete_policies ( & ctx, sanitized_params. schema , & mut builder) ;
4552 complete_roles ( & ctx, sanitized_params. schema , & mut builder) ;
53+ complete_keywords ( & ctx, & mut builder, uses_upper_case) ;
4654
4755 builder. finish ( )
4856}
0 commit comments