diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2021-12-21 14:41:23 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2021-12-21 14:41:23 +0100 |
commit | 87a26c5bf169bafbee837e2323f24cfb07e35250 (patch) | |
tree | 326eb21bb10c3d3633b83263d21c85c98f92a67e /compiler/powershell.vim | |
parent | 918610d427503c5c7b380eae4a954bd8cb427db5 (diff) | |
download | vim-polyglot-87a26c5bf169bafbee837e2323f24cfb07e35250.tar.gz vim-polyglot-87a26c5bf169bafbee837e2323f24cfb07e35250.zip |
Update
Diffstat (limited to 'compiler/powershell.vim')
-rw-r--r-- | compiler/powershell.vim | 24 |
1 files changed, 23 insertions, 1 deletions
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 |