Skip to content

Commit 37fa24e

Browse files
author
Minh-Tam TRAN
committed
feature (sln_scope_handling): stop running job only if completely covered by newly started job. Use g:OmniSharp_stop_redundant_servers to change that default behavior
1 parent 421d8d6 commit 37fa24e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

autoload/OmniSharp/actions/workspace.vim

+19-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,25 @@ function! s:ProjectsRH(job, response) abort
4343
endfor
4444
endfor
4545

46-
if a:job.sln_or_dir =~ '\.sln$'
47-
for running in OmniSharp#proc#ListRunningJobs()
48-
if index(projectFolders, running) >= 0
49-
call OmniSharp#StopServer(running)
46+
if a:job.sln_or_dir =~ '\.sln$' && get(g:, 'OmniSharp_stop_redundant_servers', 0)
47+
for runningJob in OmniSharp#proc#ListRunningJobs()
48+
let runningJobProjects = OmniSharp#proc#GetJob(running).projects
49+
let isCompletelyCoveredByNewestSolution = 1
50+
for i in range(1, len(runningJobProjects))
51+
let isProjectCoveredByNewestSolution = 0
52+
for j in range(1, len(projects))
53+
if runningJobProjects[i].path == projects[j].path
54+
let isProjectCoveredByNewestSolution = 1
55+
break
56+
endif
57+
endfor
58+
if !isProjectCoveredByNewestSolution
59+
let isCompletelyCoveredByNewestSolution = 0
60+
break
61+
endif
62+
endfor
63+
if isCompletelyCoveredByNewestSolution
64+
call OmniSharp#StopServer(runningJob)
5065
endif
5166
endfor
5267
endif

0 commit comments

Comments
 (0)