@@ -26,8 +26,8 @@ def inspect
26
26
end
27
27
28
28
def completion_candidates ( preposing , target , _postposing , bind :)
29
- @preposing = preposing
30
29
verbose , $VERBOSE = $VERBOSE, nil
30
+ @preposing = preposing
31
31
code = "#{ preposing } #{ target } "
32
32
@result = analyze code , bind
33
33
name , candidates = candidates_from_result ( @result )
@@ -36,15 +36,15 @@ def completion_candidates(preposing, target, _postposing, bind:)
36
36
candidates . map ( &:to_s ) . select { !_1 . match? ( all_symbols_pattern ) && _1 . start_with? ( name ) } . uniq . sort . map do
37
37
target + _1 [ name . size ..]
38
38
end
39
- rescue SyntaxError , StandardError => e
40
- Completor . last_completion_error = e
39
+ rescue Exception => e
41
40
handle_error ( e )
42
41
[ ]
43
42
ensure
44
43
$VERBOSE = verbose
45
44
end
46
45
47
46
def doc_namespace ( preposing , matched , postposing , bind :)
47
+ verbose , $VERBOSE = $VERBOSE, nil
48
48
name = matched [ /[a-zA-Z_0-9]*[!?=]?\z / ]
49
49
method_doc = -> type do
50
50
type = type . types . find { _1 . all_methods . include? name . to_sym }
@@ -102,6 +102,11 @@ def doc_namespace(preposing, matched, postposing, bind:)
102
102
end
103
103
else
104
104
end
105
+ rescue Exception => e
106
+ handle_error ( e )
107
+ nil
108
+ ensure
109
+ $VERBOSE = verbose
105
110
end
106
111
107
112
def candidates_from_result ( result )
@@ -229,6 +234,7 @@ def find_target(node, position)
229
234
end
230
235
231
236
def handle_error ( e )
237
+ Completor . last_completion_error = e
232
238
end
233
239
end
234
240
end
0 commit comments