File tree 2 files changed +26
-6
lines changed
2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -108,12 +108,16 @@ function! OmniSharp#FindSolutionOrDir(...) abort
108
108
let interactive = a: 0 ? a: 1 : 1
109
109
let bufnr = a: 0 > 1 ? a: 2 : bufnr (' %' )
110
110
if empty (getbufvar (bufnr , ' OmniSharp_buf_server' ))
111
- try
112
- let sln = s: FindSolution (interactive, bufnr )
113
- call setbufvar (bufnr , ' OmniSharp_buf_server' , sln)
114
- catch
115
- return ' '
116
- endtry
111
+ if exists (' g:OmniSharp_find_solution' )
112
+ let sln = call (g: OmniSharp_find_solution , [bufnr ])
113
+ else
114
+ try
115
+ let sln = s: FindSolution (interactive, bufnr )
116
+ catch
117
+ return ' '
118
+ endtry
119
+ endif
120
+ call setbufvar (bufnr , ' OmniSharp_buf_server' , sln)
117
121
endif
118
122
return getbufvar (bufnr , ' OmniSharp_buf_server' )
119
123
endfunction
Original file line number Diff line number Diff line change @@ -190,6 +190,22 @@ Default: {} >
190
190
\ 'C:\path\to\other\project': 2004,
191
191
\}
192
192
<
193
+ *g:OmniSharp_find_solution*
194
+ Function used to resolve the solution file anytime it needs to be resolved
195
+ based on the currently opened file.
196
+
197
+ This can be used in various ways, but one particular use case might be when
198
+ you need Omnisharp to stick to a given solution file that would contain all
199
+ the projects that you need to work with even though you navigate to
200
+ subprojects where other solution files could be found there. In that case, one
201
+ could pass a value along the following lines: >
202
+ let g:OmniSharp_find_solution = {bufnr -> "/path/to/main_project.sln"}
203
+ <
204
+
205
+ This is a lambda expression that always evaluates to the string
206
+ `/the/path/to/my/main_project.sln`. One could imagine more complexed cases.
207
+ It's up to the user to use this as he sees fit.
208
+
193
209
-------------------------------------------------------------------------------
194
210
3.2 DIAGNOSTICS *omnisharp-diagnostic-options*
195
211
You can’t perform that action at this time.
0 commit comments