1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:30:03 +08:00

Fix plugin manager ui: show error message

close #741
This commit is contained in:
wsdjeg 2017-07-29 21:59:04 +08:00
parent 974b635c7c
commit 2845282410
4 changed files with 24 additions and 10 deletions

View File

@ -66,8 +66,10 @@ function! s:self.start(argv, ...) abort
else
let job = jobstart(a:argv)
endi
let msg = ['process '. jobpid(job), ' run']
call extend(self.jobs, {job : msg})
if job > 0
let msg = ['process '. jobpid(job), ' run']
call extend(self.jobs, {job : msg})
endif
return job
elseif self.vim_job
if len(a:000) > 0

View File

@ -1,6 +1,6 @@
function! SpaceVim#layers#core#plugins() abort
return [
\ ['Shougo/vimproc.vim', {'build' : 'make'}],
\ ['Shougo/vimproc.vim', {'build' : ['make']}],
\ ['benizi/vim-automkdir'],
\ ['airblade/vim-rooter', {'on_cmd' : 'Rooter'}],
\ ]

View File

@ -17,11 +17,11 @@
function! SpaceVim#layers#lang#php#plugins() abort
let plugins = []
call add(plugins, ['php-vim/phpcd.vim', { 'on_ft' : 'php', 'build' : 'composer install'}])
call add(plugins, ['php-vim/phpcd.vim', { 'on_ft' : 'php', 'build' : ['composer', 'install']}])
call add(plugins, ['StanAngeloff/php.vim', { 'on_ft' : 'php'}])
call add(plugins, ['2072/PHP-Indenting-for-VIm', { 'on_ft' : 'php'}])
call add(plugins, ['rafi/vim-phpspec', { 'on_ft' : 'php'}])
call add(plugins, ['lvht/phpfold.vim', { 'on_ft' : 'php', 'build' : 'composer install'}])
call add(plugins, ['lvht/phpfold.vim', { 'on_ft' : 'php', 'build' : ['composer', 'install']}])
return plugins
endfunction

View File

@ -245,7 +245,7 @@ function! s:on_pull_exit(id, data, event) abort
if a:id == -1
redraw!
endif
if get(s:pulling_repos[id], 'build', '') !=# ''
if !empty(get(s:pulling_repos[id], 'build', ''))
call s:build(s:pulling_repos[id])
else
let s:pct_done += 1
@ -412,9 +412,17 @@ function! s:build(repo) abort
\ 'on_exit' : function('s:on_build_exit'),
\ 'cwd' : a:repo.path,
\ })
if jobid != 0
let s:building_repos[jobid] = a:repo
let s:building_repos[jobid . ''] = a:repo
if jobid > 0
call s:msg_on_build_start(a:repo.name)
elseif jobid == 0
call s:msg_on_build_failed(a:repo.name)
elseif jobid == -1
if type(argv) == type([])
call s:msg_on_build_failed(a:repo.name, argv[0] . ' is not executable')
else
call s:msg_on_build_failed(a:repo.name)
endif
endif
else
let s:building_repos[s:jobpid] = a:repo
@ -492,8 +500,12 @@ function! s:msg_on_build_done(name) abort
endfunction
" - foo.vim: Updating failed.
function! s:msg_on_build_failed(name) abort
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Building failed.')
function! s:msg_on_build_failed(name, ...) abort
if a:0 == 1
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Building failed, ' . a:1)
else
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Building failed.')
endif
endfunction
function! s:new_window() abort