Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included projects loaded in statusline #4

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions autoload/sharpenup/statusline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,33 @@ function! sharpenup#statusline#GetStatus() abort
return status
endif

let host = getbufvar(bufnr('%'), 'OmniSharp_host')
let job = empty(host) ? '' : OmniSharp#proc#GetJob(host.sln_or_dir)
if type(job) != v:t_dict
let host = OmniSharp#GetHost(bufnr('%'))
if type(host.job) != v:t_dict || get(host.job, 'stopped')
let status.State = s:t_dead
let status.Text = substitute(s:statusOpts.TextDead, '%s', '-', 'g')
return status
endif

let loaded = get(job, 'loaded', 0)
let loaded = get(host.job, 'loaded', 0)
let status.State = loaded ? s:t_ready : s:t_loading
let status.Text = loaded ? s:statusOpts.TextReady : s:statusOpts.TextLoading
if stridx(status.Text, '%s') >= 0
let sod = fnamemodify(host.sln_or_dir, ':t')
let status.Text = substitute(status.Text, '%s', sod, 'g')
endif
if match(status.Text, '%p\c') >= 0
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
let status.Text = substitute(status.Text, '%p\C', projectsloaded, 'g')
let status.Text = substitute(status.Text, '%P\C', projectstotal, 'g')
endif
return status
endfunction

Expand Down