Created
March 13, 2015 08:17
-
-
Save mattn/9735655e2ef35f88e7d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/autoload/OmniSharp.vim b/autoload/OmniSharp.vim | |
index 6ebc547..ab9adb0 100644 | |
--- a/autoload/OmniSharp.vim | |
+++ b/autoload/OmniSharp.vim | |
@@ -441,8 +441,10 @@ function! OmniSharp#StartServer() abort | |
endwhile | |
if solutionfiles ==# '' | |
- if !g:OmniSharp_graceful_startfailure | |
+ if g:OmniSharp_graceful_startfailure == 1 | |
echoerr 'Did not find a solution file' | |
+ elseif g:OmniSharp_graceful_startfailure == 2 | |
+ call OmniSharp#StartServerSolution('') | |
endif | |
return | |
endif | |
@@ -506,18 +508,23 @@ function! OmniSharp#ResolveLocalConfig(solutionPath) abort | |
endfunction | |
function! OmniSharp#StartServerSolution(solutionPath) abort | |
- if g:omnisharp_server_type ==# 'roslyn' | |
- let g:OmniSharp_running_slns += [fnamemodify(a:solutionPath, ':h')] | |
- else | |
- let g:OmniSharp_running_slns += [a:solutionPath] | |
+ let has_sln = a:solutionPath !=# '' | |
+ if has_sln | |
+ if g:omnisharp_server_type ==# 'roslyn' | |
+ let g:OmniSharp_running_slns += [fnamemodify(a:solutionPath, ':h')] | |
+ else | |
+ let g:OmniSharp_running_slns += [a:solutionPath] | |
+ endif | |
endif | |
let port = exists('b:OmniSharp_port') ? b:OmniSharp_port : g:OmniSharp_port | |
if g:omnisharp_server_type ==# 'roslyn' | |
- let command = shellescape(s:omnisharp_roslyn_server,1) . ' -p ' . port . ' -s ' . shellescape(fnamemodify(a:solutionPath, ':h'), 1) | |
+ let command = shellescape(s:omnisharp_roslyn_server,1) | |
+ \ . ' -p ' . port | |
+ \ . (has_sln ? ' -s ' . shellescape(fnamemodify(a:solutionPath, ':h'), 1) : '') | |
else | |
let command = shellescape(s:omnisharp_server,1) | |
\ . ' -p ' . port | |
- \ . ' -s ' . shellescape(a:solutionPath, 1) | |
+ \ . (has_sln ? ' -s ' . shellescape(a:solutionPath, 1) : '') | |
\ . OmniSharp#ResolveLocalConfig(a:solutionPath) | |
endif | |
if !has('win32') && !has('win32unix') && g:omnisharp_server_type !=# 'roslyn' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment