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

Receive information that a project was loaded #849

Closed
Closed
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion autoload/OmniSharp/actions/workspace.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ function! s:ProjectsRH(job, response) abort
" If no projects have been loaded by the time this callback is reached, there
" are no projects and the job can be marked as ready
let projects = get(get(a:response.Body, 'MsBuild', {}), 'Projects', {})

let a:job.projects_total = max([ get(a:job, 'projects_total', 0), len(projects) ])
let a:job.projects_loaded = get(a:job, 'projects_loaded', 0)
let a:job.projects = map(projects,
\ {_,project -> {"name": project.AssemblyName, "path": project.Path, "target": project.TargetPath}})
if get(a:job, 'projects_total', 0) > 0

if a:job.projects_total > 0
call OmniSharp#log#Log(a:job, 'Workspace complete: ' . a:job.projects_total . ' project(s)')
else
call OmniSharp#log#Log(a:job, 'Workspace complete: no projects')
Expand Down
29 changes: 17 additions & 12 deletions autoload/OmniSharp/project.vim
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,27 @@
let a:job.projects_total = len(a:job.loading)
silent doautocmd <nomodeline> User OmniSharpProjectUpdated
endif
endif
if message =~# '^Successfully loaded project'
\ || message =~# '^Failed to load project'
elseif message =~# '^Successfully loaded project' || message =~# '^Failed to load project'
if message[0] ==# 'F'
echom 'Failed to load project: ' . project
endif
call filter(a:job.loading, {idx,val -> val !=# project})
let a:job.projects_loaded = projects_loaded + 1
silent doautocmd <nomodeline> User OmniSharpProjectUpdated
if len(a:job.loading) == 0
call OmniSharp#project#RegisterLoaded(a:job)
unlet a:job.loading
call timer_stop(a:job.loading_timeout)
unlet a:job.loading_timeout
endif
call s:AcknowledgeLoadedProject(a:job, project)
endif
elseif has_key(a:job, 'restart_time') && a:event ==# 'MsBuildProjectDiagnostics'
let project = a:eventBody.FileName
call s:AcknowledgeLoadedProject(a:job, project)
endif
endfunction

function! s:AcknowledgeLoadedProject(job, project)

Check failure on line 87 in autoload/OmniSharp/project.vim

View workflow job for this annotation

GitHub Actions / runner / vint

[vint] reported by reviewdog 🐶 Use the abort attribute for functions in autoload (see Google VimScript Style Guide (Functions)) Raw Output: autoload/OmniSharp/project.vim:87:1: Use the abort attribute for functions in autoload (see Google VimScript Style Guide (Functions))
call filter(a:job.loading, {idx,val -> val !=# a:project})
let a:job.projects_loaded = get(a:job, 'projects_loaded', 0) + 1
silent doautocmd <nomodeline> User OmniSharpProjectUpdated
if empty(a:job.loading)
call OmniSharp#project#RegisterLoaded(a:job)
unlet a:job.loading
call timer_stop(a:job.loading_timeout)
unlet a:job.loading_timeout
endif
endfunction

Expand Down
Loading