From 1008959d621ffbbde62f9acf2abf2df83e467e2b Mon Sep 17 00:00:00 2001 From: corbob Date: Sat, 27 Apr 2019 18:18:16 -0700 Subject: [PATCH] Accept 'preview' as an install parameter. Testing type of parameter to make sure string is tested as string and dict as dict. Type information can be found with `:help type` --- autoload/coc/powershell.vim | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/autoload/coc/powershell.vim b/autoload/coc/powershell.vim index 710c4f6..ed7d1e9 100644 --- a/autoload/coc/powershell.vim +++ b/autoload/coc/powershell.vim @@ -7,16 +7,25 @@ let s:is_vim = !has('nvim') let s:install_script = s:root.'/install.ps1' function! coc#powershell#install(...) - if(exists('a:1.preview') && a:1.preview) - let s:flags = '-AllowPreRelease' - else - let s:flags = '' + let s:flags = '' + if(exists('a:1')) + let paramType = type(a:1) + " Type 1 seems to be a string... + if(paramType == 1) + if(a:1 == 'preview') + let s:flags = '-AllowPreRelease' + endif + " Type 4 is a dictionary... + elseif(s:paramType == 4) + if(exists('a:1.preview') && a:1.preview) + let s:flags = '-AllowPreRelease' + endif + endif endif - let s:powershell_executable = '' + let s:powershell_executable = 'pwsh' if(exists('a:1.powershellExecutable')) let s:powershell_executable = a:1.powershellExecutable else - let s:powershell_executable = 'pwsh' if(s:is_win) let s:powershell_executable = "powershell" if(executable("pwsh"))