install.fairie/dotfiles/.vim/plugged/vim-airline/autoload/airline/extensions/omnisharp.vim
Git E2E Dev Test Username 6892bd7dbd git subrepo clone https://github.com/vim-airline/vim-airline.git ./dotfiles/.vim/plugged/vim-airline
subrepo:
  subdir:   "dotfiles/.vim/plugged/vim-airline"
  merged:   "0ed7b8b"
upstream:
  origin:   "https://github.com/vim-airline/vim-airline.git"
  branch:   "master"
  commit:   "0ed7b8b"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:36:08 -04:00

45 lines
1.2 KiB
VimL

" MIT License
" Plugin: https://github.com/OmniSharp/omnisharp-vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'OmniSharp_loaded', 0)
finish
endif
function! airline#extensions#omnisharp#server_status(...) abort
if !exists(':OmniSharpGotoDefinition') || !get(g:, 'OmniSharp_server_stdio', 0)
return ''
endif
let host = OmniSharp#GetHost(bufnr('%'))
if type(host.job) != v:t_dict || get(host.job, 'stopped')
return ''
endif
let sln = fnamemodify(host.sln_or_dir, ':t')
if get(host.job, 'loaded', 0)
return sln
endif
try
let projectsloaded = OmniSharp#project#CountLoaded()
let projectstotal = OmniSharp#project#CountTotal()
catch
" The CountLoaded and CountTotal functions are very new - catch the error
" when they don't exist
let projectsloaded = 0
let projectstotal = 0
endtry
return printf('%s(%d/%d)', sln, projectsloaded, projectstotal)
endfunction
function! airline#extensions#omnisharp#init(ext) abort
call airline#parts#define_function('omnisharp', 'airline#extensions#omnisharp#server_status')
augroup airline_omnisharp
autocmd!
autocmd User OmniSharpStarted,OmniSharpReady,OmniSharpStopped AirlineRefresh!
augroup END
endfunction