This commit is contained in:
Adam Stankiewicz
2019-12-07 12:21:37 +01:00
parent 15aeea662e
commit 7a0f2d974f
51 changed files with 270 additions and 122 deletions

View File

@@ -1,6 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Author: Kevin Ballard
" Description: Helper functions for Rust commands/mappings
" Last Modified: May 27, 2014
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
@@ -510,16 +509,23 @@ function! s:SearchTestFunctionNameUnderCursor() abort
return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*')
endfunction
function! rust#Test(all, options) abort
function! rust#Test(mods, winsize, all, options) abort
let manifest = findfile('Cargo.toml', expand('%:p:h') . ';')
if manifest ==# ''
return rust#Run(1, '--test ' . a:options)
endif
" <count> defaults to 0, but we prefer an empty string
let winsize = a:winsize ? a:winsize : ''
if has('terminal')
let cmd = 'terminal '
if has('patch-8.0.910')
let cmd = printf('%s noautocmd %snew | terminal ++curwin ', a:mods, winsize)
else
let cmd = printf('%s terminal ', a:mods)
endif
elseif has('nvim')
let cmd = 'noautocmd new | terminal '
let cmd = printf('%s noautocmd %snew | terminal ', a:mods, winsize)
else
let cmd = '!'
let manifest = shellescape(manifest)