Skip to content

Commit 2ce53e4

Browse files
author
Minh-Tam TRAN
committed
Given a solution and its projects, when starting the server, kill running servers whose scope is one of the solution's projects, since it is already covered by the solution server
1 parent 49f5626 commit 2ce53e4

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

autoload/OmniSharp/actions/workspace.vim

+16-10
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,24 @@ function! s:ProjectsRH(job, response) abort
3232
endif
3333

3434
let projectFolders = mapnew(projects, {_,p -> fnamemodify(p.path, ':p:h') })
35-
for i in filter(range(1, bufnr('$')), {_,x -> bufexists(x) && !empty(getbufvar(x, "OmniSharp_host"))})
35+
for i in filter(range(1, bufnr('$')), {_,x -> bufexists(x) && !empty(getbufvar(x, "OmniSharp_host")) && getbufvar(x, "OmniSharp_host").sln_or_dir != a:job.sln_or_dir})
3636
let host = getbufvar(i, "OmniSharp_host")
37-
if index(projectFolders, host.sln_or_dir) < 0 || !host.initialized
38-
let filePath = fnamemodify(bufname(i), ':p')
39-
for projectFolder in projectFolders
40-
if stridx(filePath, projectFolder) == 0
41-
let host.sln_or_dir = a:job.sln_or_dir
42-
break
43-
endif
44-
endfor
45-
endif
37+
let filePath = fnamemodify(bufname(i), ':p')
38+
for projectFolder in projectFolders
39+
if stridx(filePath, projectFolder) == 0
40+
let host.sln_or_dir = a:job.sln_or_dir
41+
break
42+
endif
43+
endfor
4644
endfor
45+
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)
50+
endif
51+
endfor
52+
endif
4753
endfunction
4854

4955
let &cpoptions = s:save_cpo

0 commit comments

Comments
 (0)