@@ -4,26 +4,24 @@ set cpoptions&vim
4
4
" Navigate to the definition of the symbol under the cursor.
5
5
" Optional arguments:
6
6
" Callback: When a callback is passed in, it is called after the response is
7
- " returned (synchronously or asynchronously) with a boolean 'found'
8
- " result.
7
+ " returned (synchronously or asynchronously) with the found
8
+ " location and a flag for whether it is in a file in the project or
9
+ " from the metadata. This is done instead of navigating to the found
10
+ " location.
9
11
" editcommand: The command to use to open buffers, e.g. 'split', 'vsplit',
10
12
" 'tabedit' or 'edit' (default).
11
13
function ! OmniSharp#actions#definition#Find (... ) abort
12
- let opts = { ' editcommand' : ' edit' }
13
14
if a: 0 && type (a: 1 ) == type (function (' tr' ))
14
- let opts.Callback = a: 1
15
- endif
16
- if a: 0 > 1 && type (a: 2 ) == type (function (' tr' ))
17
- let opts.Callback = a: 2
18
- endif
15
+ let Callback = a: 1
16
+ else
17
+ let opts = { ' editcommand' : ' edit' }
19
18
if a: 0 && type (a: 1 ) == type (' ' ) && a: 1 !=# ' '
20
19
let opts.editcommand = a: 1
21
20
endif
22
- if a: 0 > 1 && type (a: 2 ) == type (' ' ) && a: 1 !=# ' '
23
- let opts.editcommand = a: 2
21
+ let Callback = function (' s:CBGotoDefinition' , [opts])
24
22
endif
23
+
25
24
if g: OmniSharp_server_stdio
26
- let Callback = function (' s:CBGotoDefinition' , [opts])
27
25
call s: StdioFind (Callback)
28
26
else
29
27
let loc = OmniSharp#py#Eval (' gotoDefinition()' )
@@ -33,8 +31,7 @@ function! OmniSharp#actions#definition#Find(...) abort
33
31
endif
34
32
endfunction
35
33
36
- function ! OmniSharp#actions#definition#Preview (... ) abort
37
- let opts = a: 0 && a: 1 isnot 0 ? { ' Callback' : a: 1 } : {}
34
+ function ! OmniSharp#actions#definition#Preview () abort
38
35
if g: OmniSharp_server_stdio
39
36
let Callback = function (' s:CBPreviewDefinition' )
40
37
call s: StdioFind (Callback)
@@ -115,9 +112,6 @@ function! s:CBGotoDefinition(opts, location, fromMetadata) abort
115
112
setlocal nomodifiable readonly
116
113
endif
117
114
endif
118
- if has_key (a: opts , ' Callback' )
119
- call a: opts .Callback (found)
120
- endif
121
115
return found
122
116
endfunction
123
117
0 commit comments