diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-04 19:18:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 19:18:16 -0400 |
commit | 4ad30f775e5564c539324b4818886f067d2ecd99 (patch) | |
tree | 97a554379bda7e5fc77e58c690db3f5a72db8c74 /runtime/compiler/powershell.vim | |
parent | 63d8a8f4e8b02e524d85aed08aa16c5d9815598c (diff) | |
parent | d5b063aec1db95704b37a77fdbd968cb6b48cc3b (diff) | |
download | rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.tar.gz rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.tar.bz2 rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.zip |
Merge pull request #14424 from janlazo/vim-8.1.1726
vim-patch:8.1.1726,8.2.{296,860,1827,2388,2788,2790,2801}
Diffstat (limited to 'runtime/compiler/powershell.vim')
-rw-r--r-- | runtime/compiler/powershell.vim | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/runtime/compiler/powershell.vim b/runtime/compiler/powershell.vim new file mode 100644 index 0000000000..45d5ec2191 --- /dev/null +++ b/runtime/compiler/powershell.vim @@ -0,0 +1,84 @@ +" Vim compiler file +" Compiler: powershell +" URL: https://github.com/PProvost/vim-ps1 +" Last Change: 2020 Mar 30 + +if exists("current_compiler") + finish +endif +let current_compiler = "powershell" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +if !exists("g:ps1_makeprg_cmd") + if executable('pwsh') + " pwsh is the future + let g:ps1_makeprg_cmd = 'pwsh' + elseif executable('pwsh.exe') + let g:ps1_makeprg_cmd = 'pwsh.exe' + elseif executable('powershell.exe') + let g:ps1_makeprg_cmd = 'powershell.exe' + else + let g:ps1_makeprg_cmd = '' + endif +endif + +if !executable(g:ps1_makeprg_cmd) + echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!" +endif + +" Show CategoryInfo, FullyQualifiedErrorId, etc? +let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0) + +" 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' + +" Parse file, line, char from callstacks: +" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a +" cmdlet, function, script file, or operable program. Check the spelling +" of the name, or if a path was included, verify that the path is correct +" and try again. +" At C:\script.ps1:11 char:5 +" + Write-Ouput $content +" + ~~~~~~~~~~~ +" + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException +" + FullyQualifiedErrorId : CommandNotFoundException + +" Showing error in context with underlining. +CompilerSet errorformat=%+G+%m +" Error summary. +CompilerSet errorformat+=%E%*\\S\ :\ %m +" Error location. +CompilerSet errorformat+=%CAt\ %f:%l\ char:%c +" Errors that span multiple lines (may be wrapped to width of terminal). +CompilerSet errorformat+=%C%m +" Ignore blank/whitespace-only lines. +CompilerSet errorformat+=%Z\\s%# + +if g:ps1_efm_show_error_categories + CompilerSet errorformat^=%+G\ \ \ \ +\ %.%#\\s%#:\ %m +else + CompilerSet errorformat^=%-G\ \ \ \ +\ %.%#\\s%#:\ %m +endif + + +" Parse file, line, char from of parse errors: +" At C:\script.ps1:22 char:16 +" + Stop-Process -Name "invalidprocess +" + ~~~~~~~~~~~~~~~ +" The string is missing the terminator: ". +" + CategoryInfo : ParserError: (:) [], ParseException +" + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString +CompilerSet errorformat+=At\ %f:%l\ char:%c + + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: |