summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ledger.vim4
-rw-r--r--compiler/powershell.vim24
2 files changed, 25 insertions, 3 deletions
diff --git a/compiler/ledger.vim b/compiler/ledger.vim
index 3fca6442..1e35f64b 100644
--- a/compiler/ledger.vim
+++ b/compiler/ledger.vim
@@ -30,7 +30,7 @@ if !g:ledger_is_hledger
CompilerSet errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m
" Skip all other lines:
CompilerSet errorformat+=%-G%.%#
- exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . expand('g:ledger_main::S') . '\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ ' . expand('g:ledger_main::S')
+ exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ ' . shellescape(expand(g:ledger_main))
else
- exe 'CompilerSet makeprg=('.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . expand('g:ledger_main::S') . '\ print\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g') . '\ >\ /dev/null)'
+ exe 'CompilerSet makeprg=('.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . substitute(shellescape(expand(g:ledger_main)), ' ', '\\ ', 'g') . '\ print\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ >\ /dev/null)'
endif
diff --git a/compiler/powershell.vim b/compiler/powershell.vim
index 0ba5776c..99fbfa32 100644
--- a/compiler/powershell.vim
+++ b/compiler/powershell.vim
@@ -33,14 +33,36 @@ endif
if !executable(g:ps1_makeprg_cmd)
echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!"
+ finish
endif
" Show CategoryInfo, FullyQualifiedErrorId, etc?
let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0)
+let &l:makeprg = g:ps1_makeprg_cmd
+" Load Vanilla Shell and show syntax errors
+" See https://zigford.org/powershell-syntax-now-supported-by-ale-vim-plugin.html
+if has('win32')
+setlocal makeprg+=\ -NoProfile\ -NoLogo\ -NonInteractive\ -command\ \"&{
+ \trap{$_.tostring();continue}&{
+ \[void]$executioncontext.invokecommand.invokescript('%')
+ \}
+ \}\"
+elseif has('unix')
+setlocal makeprg+=\ -NoProfile\ -NoLogo\ -NonInteractive\ -command\ "&{
+ \trap{\\$_.tostring();continue}&{
+ \[void]\\$executioncontext.invokecommand.invokescript('%')
+ \}
+ \}"
+ \}\"
+else
+ echoerr "To use the powershell compiler, please run it under Microsoft Windows or Unix!"
+ finish
+endif
" Use absolute path because powershell requires explicit relative paths
" (./file.ps1 is okay, but # expands to file.ps1)
-let &l:makeprg = g:ps1_makeprg_cmd .' %:p:S'
+setlocal makeprg+=\ %:p:S
+silent CompilerSet makeprg
" Parse file, line, char from callstacks:
" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a