Skip to content

Commit 46f1ea9

Browse files
committed
done (priority: vim8 async > dispatch > blocked build)
1 parent 23d8c24 commit 46f1ea9

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

autoload/codequery.vim

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,24 @@ function! codequery#make_codequery_db(args) abort
130130
continue
131131
endif
132132

133-
" TODO: Rewrite it when Vim8 is coming
134-
" ----------------------------------------------------------------
135-
if exists(':Start')
133+
if v:version >= 800
134+
echom 'Making ...'
135+
let mydict = {'db_path': db_path,
136+
\'callback': function("codequery#db#make_db_callback")}
137+
let options = {'out_io': 'null',
138+
\'exit_cb': mydict.callback}
139+
let s:build_job = job_start(['/bin/sh', '-c', shell_cmd], options)
140+
let timer = timer_start(500,
141+
\{-> execute("call job_status(s:build_job)","")},
142+
\{'repeat': 60})
143+
elseif exists(':Start')
136144
silent execute 'Start! -title=Make_CodeQuery_DB -wait=error ' . shell_cmd
137145
redraw!
138-
echom 'Making ' . db_path ' => Run :CodeQueryViewDB to Check Status'
146+
echom 'Making ... ' . db_path ' => Run :CodeQueryViewDB to Check Status'
139147
else
140148
silent execute '!' . shell_cmd
141149
redraw!
142150
endif
143-
" ----------------------------------------------------------------
144151
endfor
145152
call s:restore_cwd()
146153
endfunction

autoload/codequery/db.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ function! codequery#db#find_db_path(filetype) abort
3636
endfunction
3737

3838

39+
function! codequery#db#make_db_callback(job, status) dict
40+
echom 'Done! (' . self.db_path . ')'
41+
endfunction
42+
43+
3944
function! codequery#db#construct_python_db_build_cmd(db_path) abort
4045
let find_cmd = 'find . -iname "*.py" > python_cscope.files'
4146
let pycscope_cmd = 'pycscope -f "python_cscope.out" -i python_cscope.files'

0 commit comments

Comments
 (0)