the caas service is fully integrated now.

this commit enables it by default if your project has a nimrod.cfg config, but
the results won't be satisfactory as the compiler still cannot survive the long-
running interaction with the IDE and breaks after a couple of commands.
This commit is contained in:
Zahary Karadjov 2013-05-01 21:24:10 +03:00
commit ffc49b7c2a
2 changed files with 27 additions and 13 deletions

View file

@ -1,11 +1,34 @@
let g:nimrod_log = [] let g:nimrod_log = []
let s:plugin_path = escape(expand('<sfile>:p:h'), ' \') let s:plugin_path = escape(expand('<sfile>:p:h'), ' \')
if !exists("g:nimrod_caas_enabled")
let g:nimrod_caas_enabled = 1
endif
exe 'pyfile ' . fnameescape(s:plugin_path) . '/nimrod_vim.py' exe 'pyfile ' . fnameescape(s:plugin_path) . '/nimrod_vim.py'
if !executable('nimrod')
echoerr "the nimrod compiler must be in your system's PATH"
endif
fun! nimrod#init() fun! nimrod#init()
let b:nimrod_project_root = "/foo" let cmd = printf("nimrod --dump.format:json --verbosity:0 dump %s", s:CurrentNimrodFile())
let b:nimrod_caas_enabled = 0 let raw_dumpdata = system(cmd)
if !v:shell_error
" the silent bit is to ignore a warning about trailing characters
let dumpdata = eval(substitute(raw_dumpdata, "\n", "", "g"))
let b:nimrod_project_root = dumpdata['project_path']
let b:nimrod_caas_enabled = g:nimrod_caas_enabled
for path in dumpdata['lib_paths']
if finddir(path) == path
let &l:path = path . "," . &l:path
endif
endfor
else
let b:nimrod_caas_enabled = 0
endif
endf endf
fun! s:UpdateNimLog() fun! s:UpdateNimLog()
@ -27,6 +50,8 @@ augroup NimLog
au BufEnter log://nimrod call s:UpdateNimLog() au BufEnter log://nimrod call s:UpdateNimLog()
augroup END augroup END
command! NimLog :e log://nimrod
fun! s:CurrentNimrodFile() fun! s:CurrentNimrodFile()
let save_cur = getpos('.') let save_cur = getpos('.')
call cursor(0, 0, 0) call cursor(0, 0, 0)

View file

@ -15,17 +15,6 @@ setlocal commentstring=#\ %s
setlocal omnifunc=NimComplete setlocal omnifunc=NimComplete
setlocal suffixesadd=.nim setlocal suffixesadd=.nim
if executable('nimrod')
let nimrod_paths = split(system('nimrod dump'),'\n')
let &l:path = &g:path
for path in nimrod_paths
if finddir(path) == path
let &l:path = path . "," . &l:path
endif
endfor
endif
compiler nimrod compiler nimrod
let &cpo = s:cpo_save let &cpo = s:cpo_save