diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-03-02 00:34:02 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-03-02 00:34:02 +0100 |
commit | 6b540d7db030e4110aa3a31dd06c6c41387444db (patch) | |
tree | 1cd1da5b35cf1c34b38d7506ff93aabf861747bf /compiler | |
parent | 35ea4d2b9072594b6c0ccf87bde7978ed9f94755 (diff) | |
download | vim-polyglot-6b540d7db030e4110aa3a31dd06c6c41387444db.tar.gz vim-polyglot-6b540d7db030e4110aa3a31dd06c6c41387444db.zip |
Update
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/powershell.vim | 80 | ||||
-rw-r--r-- | compiler/swift.vim | 43 |
2 files changed, 123 insertions, 0 deletions
diff --git a/compiler/powershell.vim b/compiler/powershell.vim new file mode 100644 index 00000000..4d9d76b0 --- /dev/null +++ b/compiler/powershell.vim @@ -0,0 +1,80 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') == -1 + +" Compiler: powershell +" Run ps1 scripts in powershell and process their output. Quickly jump through +" stack traces and see script output in the quickfix. + +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 !has('win32') || executable('pwsh') + " pwsh is the future + let g:ps1_makeprg_cmd = 'pwsh' + else + " powershell is Windows-only + let g:ps1_makeprg_cmd = 'powershell' + endif +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' + +" 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: + +endif diff --git a/compiler/swift.vim b/compiler/swift.vim new file mode 100644 index 00000000..5dab34f6 --- /dev/null +++ b/compiler/swift.vim @@ -0,0 +1,43 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 + +" Vim compiler file +" Compiler: Swift Compiler +" Maintainer: Ayman Bagabas <ayman.bagabas@gmail.com> +" Latest Revision: 2020 Feb 16 + +if exists("current_compiler") + finish +endif +let current_compiler = "swiftc" + +" vint: -ProhibitAbbreviationOption +let s:save_cpo = &cpo +set cpo&vim +" vint: +ProhibitAbbreviationOption + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +if has('patch-7.4.191') + CompilerSet makeprg=swiftc\ \%:S +else + CompilerSet makeprg=swiftc\ \% +endif + +CompilerSet errorformat= + \%E%f:%l:%c:\ %trror:\ %m, + \%W%f:%l:%c:\ %tarning:\ %m, + \%I%f:%l:%c:\ note:\ %m, + \%E%f:%l:\ %trror:\ %m, + \%W%f:%l:\ %tarning:\ %m, + \%I%f:%l:\ note:\ %m, + +" vint: -ProhibitAbbreviationOption +let &cpo = s:save_cpo +unlet s:save_cpo +" vint: +ProhibitAbbreviationOption + +" vim: set et sw=4 sts=4 ts=8: + +endif |