This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree 1 file changed +12
-9
lines changed
1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -201,14 +201,16 @@ impl RequestAction for Definition {
201
201
let span = ctx. convert_pos_to_span ( file_path. clone ( ) , params. position ) ;
202
202
let analysis = ctx. analysis . clone ( ) ;
203
203
204
- match analysis. goto_def ( & span) {
205
- Ok ( out) => {
206
- let result = vec ! [ ls_util:: rls_to_location( & out) ] ;
207
- trace ! ( "goto_def (compiler): {:?}" , result) ;
208
- Ok ( result)
209
- }
210
- // If analysis failed & `racer_completion` is enabled try racer
211
- _ if ctx. config . lock ( ) . unwrap ( ) . racer_completion => {
204
+ if let Ok ( out) = analysis. goto_def ( & span) {
205
+ let result = vec ! [ ls_util:: rls_to_location( & out) ] ;
206
+ trace ! ( "goto_def (compiler): {:?}" , result) ;
207
+ Ok ( result)
208
+ } else {
209
+ let racer_enabled = {
210
+ let config = ctx. config . lock ( ) . unwrap ( ) ;
211
+ config. racer_completion
212
+ } ;
213
+ if racer_enabled {
212
214
let cache = ctx. racer_cache ( ) ;
213
215
let session = ctx. racer_session ( & cache) ;
214
216
let location = pos_to_racer_location ( params. position ) ;
@@ -220,8 +222,9 @@ impl RequestAction for Definition {
220
222
221
223
trace ! ( "goto_def (Racer): {:?}" , r) ;
222
224
Ok ( r)
225
+ } else {
226
+ Self :: fallback_response ( )
223
227
}
224
- _ => Self :: fallback_response ( ) ,
225
228
}
226
229
}
227
230
}
You can’t perform that action at this time.
0 commit comments