File tree 2 files changed +5
-13
lines changed
crates/pgt_completions/src
2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,7 @@ pub struct CompletionParams<'a> {
23
23
position = params. position. to_string( )
24
24
) ) ]
25
25
pub fn complete ( params : CompletionParams ) -> Vec < CompletionItem > {
26
- let sanitized_params = match SanitizedCompletionParams :: try_from ( params) {
27
- Ok ( p) => p,
28
- Err ( err) => {
29
- tracing:: warn!( "Not possible to get completions: {}" , err) ;
30
- return vec ! [ ] ;
31
- }
32
- } ;
26
+ let sanitized_params = SanitizedCompletionParams :: from ( params) ;
33
27
34
28
let ctx = CompletionContext :: new ( & sanitized_params) ;
35
29
Original file line number Diff line number Diff line change @@ -16,20 +16,18 @@ pub fn benchmark_sanitization(params: CompletionParams) -> String {
16
16
params. text
17
17
}
18
18
19
- impl < ' larger , ' smaller > TryFrom < CompletionParams < ' larger > > for SanitizedCompletionParams < ' smaller >
19
+ impl < ' larger , ' smaller > From < CompletionParams < ' larger > > for SanitizedCompletionParams < ' smaller >
20
20
where
21
21
' larger : ' smaller ,
22
22
{
23
- type Error = String ;
24
-
25
- fn try_from ( params : CompletionParams < ' larger > ) -> Result < Self , Self :: Error > {
23
+ fn from ( params : CompletionParams < ' larger > ) -> Self {
26
24
if cursor_inbetween_nodes ( params. tree , params. position )
27
25
|| cursor_prepared_to_write_token_after_last_node ( params. tree , params. position )
28
26
|| cursor_before_semicolon ( params. tree , params. position )
29
27
{
30
- Ok ( SanitizedCompletionParams :: with_adjusted_sql ( params) )
28
+ SanitizedCompletionParams :: with_adjusted_sql ( params)
31
29
} else {
32
- Ok ( SanitizedCompletionParams :: unadjusted ( params) )
30
+ SanitizedCompletionParams :: unadjusted ( params)
33
31
}
34
32
}
35
33
}
You can’t perform that action at this time.
0 commit comments