@@ -13,23 +13,38 @@ function! OmniSharp#project#CountTotal() abort
1313 return get (OmniSharp#proc#GetJob (host.sln_or_dir), ' projects_total' , 0 )
1414endfunction
1515
16+ function ! OmniSharp#project#RegisterLoaded (job) abort
17+ if a: job .loaded | return | endif
18+ if g: OmniSharp_server_display_loading
19+ let elapsed = reltimefloat (reltime (a: job .start_time))
20+ echomsg printf (' Loaded server for %s in %.1fs' ,
21+ \ a: job .sln_or_dir, elapsed)
22+ endif
23+ let a: job .loaded = 1
24+ silent doautocmd <nomodeline> User OmniSharpReady
25+
26+ " TODO: Remove this delay once we have better information about
27+ " when the server is completely initialised:
28+ " https://github.com/OmniSharp/omnisharp-roslyn/issues/1521
29+ call timer_start (1000 , function (' OmniSharp#stdio#ReplayRequests' , [a: job ]))
30+ " call OmniSharp#stdio#ReplayRequests(a:job)
31+ endfunction
32+
1633" Listen for stdio server-loaded events
1734function ! OmniSharp#project#ParseEvent (job, event , eventBody) abort
1835 if g: OmniSharp_server_stdio_quickload
1936
20- " Quick load: Mark server as loaded as soon as configuration is finished
37+ " Quick load: Mark server as ready as soon as configuration is finished.
38+ " WARNING: This will _not_ result in fully functional server interaction.
2139 if a: job .loaded | return | endif
2240 let message = get (a: eventBody , ' Message' , ' ' )
2341 if message == # ' Configuration finished.'
24- let a: job .loaded = 1
25- silent doautocmd <nomodeline> User OmniSharpReady
26- call OmniSharp#stdio#ReplayRequests ()
42+ call OmniSharp#project#RegisterLoaded (a: job )
2743 endif
2844
2945 else
3046
31- " Complete load: Wait for all projects to be loaded before marking server as
32- " loaded
47+ " Full load: Wait for all projects to load before marking server as ready
3348 let projects_loaded = get (a: job , ' projects_loaded' , 0 )
3449 let projects_total = get (a: job , ' projects_total' , 0 )
3550 if a: job .loaded && projects_loaded == projects_total | return | endif
@@ -46,7 +61,9 @@ function! OmniSharp#project#ParseEvent(job, event, eventBody) abort
4661 endif
4762 let name = get (a: eventBody , ' Name' , ' ' )
4863 let message = get (a: eventBody , ' Message' , ' ' )
49- if name == # ' OmniSharp.MSBuild.ProjectManager'
64+ if a: event == # ' started'
65+ call OmniSharp#actions#workspace#Get (a: job )
66+ elseif name == # ' OmniSharp.MSBuild.ProjectManager'
5067 let project = matchstr (message, ' ' ' \zs.*\ze'' ' )
5168 if message = ~# ' ^Queue project'
5269 call add (a: job .loading, project)
@@ -64,20 +81,7 @@ function! OmniSharp#project#ParseEvent(job, event, eventBody) abort
6481 let a: job .projects_loaded = projects_loaded + 1
6582 silent doautocmd <nomodeline> User OmniSharpProjectUpdated
6683 if len (a: job .loading) == 0
67- if g: OmniSharp_server_display_loading
68- let elapsed = reltimefloat (reltime (a: job .start_time))
69- echomsg printf (' Loaded server for %s in %.1fs' ,
70- \ a: job .sln_or_dir, elapsed)
71- endif
72- let a: job .loaded = 1
73- silent doautocmd <nomodeline> User OmniSharpReady
74-
75- " TODO: Remove this delay once we have better information about
76- " when the server is completely initialised:
77- " https://github.com/OmniSharp/omnisharp-roslyn/issues/1521
78- call timer_start (1000 , function (' OmniSharp#stdio#ReplayRequests' ))
79- " call OmniSharp#stdio#ReplayRequests()
80-
84+ call OmniSharp#project#RegisterLoaded (a: job )
8185 unlet a: job .loading
8286 call timer_stop (a: job .loading_timeout)
8387 unlet a: job .loading_timeout
0 commit comments