Skip to content

Commit 98a3075

Browse files
committed
Move log config variable parsing from plugin/OmniSharp.vim to autoload\OmniSharp\log.vim
1 parent 93692ee commit 98a3075

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

autoload/OmniSharp.vim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,9 @@ function! OmniSharp#Install(...) abort
429429
let l:http = g:OmniSharp_server_stdio ? '' : '-H'
430430
let l:version = a:0 > 0 ? '-v ' . shellescape(a:1) : ''
431431
let l:location = shellescape(OmniSharp#util#ServerDir())
432+
let l:logfile = OmniSharp#log#GetLogDir() . '\install.log'
432433

433434
if has('win32')
434-
let l:logfile = g:OmniSharp_log_dir . '\install.log'
435435
let l:script = shellescape(
436436
\ s:plugin_root_dir . '\installer\omnisharp-manager.ps1')
437437
let l:version_file_location = l:location . '\OmniSharpInstall-version.txt'
@@ -440,7 +440,6 @@ function! OmniSharp#Install(...) abort
440440
\ 'powershell -ExecutionPolicy Bypass -File %s %s -l %s %s',
441441
\ l:script, l:http, l:location, l:version)
442442
else
443-
let l:logfile = g:OmniSharp_log_dir . '/install.log'
444443
let l:script = shellescape(
445444
\ s:plugin_root_dir . '/installer/omnisharp-manager.sh')
446445
let l:mono = g:OmniSharp_server_use_mono ? '-M' : ''

autoload/OmniSharp/log.vim

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
let s:save_cpo = &cpoptions
22
set cpoptions&vim
33

4-
let s:stdiologfile = g:OmniSharp_log_dir . '/stdio.log'
4+
if has('win32')
5+
let default_log_dir = expand('<sfile>:p:h:h:h') . '\log'
6+
else
7+
let default_log_dir = expand('<sfile>:p:h:h:h') . '/log'
8+
end
9+
10+
let s:logdir = get(g:, 'OmniSharp_log_dir', default_log_dir)
11+
let s:stdiologfile = s:logdir . '/stdio.log'
12+
13+
" Make the log directory if it doesn't exist
14+
if !isdirectory(g:OmniSharp_log_dir)
15+
call mkdir(g:OmniSharp_log_dir, 'p')
16+
end
17+
18+
function! OmniSharp#log#GetLogDir() abort
19+
return s:logdir
20+
endfunction
521

622
" Log from OmniSharp-vim
723
function! OmniSharp#log#Log(job, message, ...) abort

plugin/OmniSharp.vim

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ let g:OmniSharp_start_without_solution = get(g:, 'OmniSharp_start_without_soluti
3030
" Automatically start server
3131
let g:OmniSharp_start_server = get(g:, 'OmniSharp_start_server', get(g:, 'Omnisharp_start_server', 1))
3232

33-
if has('win32')
34-
let default_log_dir = expand('<sfile>:p:h:h') . '\log'
35-
else
36-
let default_log_dir = expand('<sfile>:p:h:h') . '/log'
37-
end
38-
let g:OmniSharp_log_dir = get(g:, 'OmniSharp_log_dir', default_log_dir)
39-
4033
let defaultlevel = g:OmniSharp_server_stdio ? 'info' : 'warning'
4134
let g:OmniSharp_loglevel = get(g:, 'OmniSharp_loglevel', defaultlevel)
4235

@@ -137,9 +130,4 @@ if g:OmniSharp_selector_ui ==? 'ctrlp'
137130
endif
138131
endif
139132

140-
" Make the log directory if it doesn't exist
141-
if !isdirectory(g:OmniSharp_log_dir)
142-
call mkdir(g:OmniSharp_log_dir, "p")
143-
end
144-
145133
" vim:et:sw=2:sts=2

0 commit comments

Comments
 (0)