annotate runtime/compiler/powershell.vim @ 29421:61796d98c856 v9.0.0052

patch 9.0.0052: "zG" may throw an error if invalid character follows Commit: https://github.com/vim/vim/commit/2ebcc35826bc2deb04e5fc6d73332f55783e7f52 Author: K.Takata <kentkt@csc.jp> Date: Thu Jul 14 17:25:14 2022 +0100 patch 9.0.0052: "zG" may throw an error if invalid character follows Problem: "zG" may throw an error if invalid character follows. Solution: Pass the word length to valid_spell_word(). (Ken Takata, closes #10737)
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Jul 2022 18:30:04 +0200
parents 5c98ea5f5d6e
children 2c3f939d46bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24387
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim compiler file
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Compiler: powershell
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " URL: https://github.com/PProvost/vim-ps1
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2020 Mar 30
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists("current_compiler")
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let current_compiler = "powershell"
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 if exists(":CompilerSet") != 2 " older Vim always used :setlocal
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 command -nargs=* CompilerSet setlocal <args>
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 let s:cpo_save = &cpo
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 set cpo-=C
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 if !exists("g:ps1_makeprg_cmd")
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 if executable('pwsh')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 " pwsh is the future
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 let g:ps1_makeprg_cmd = 'pwsh'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 elseif executable('pwsh.exe')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 let g:ps1_makeprg_cmd = 'pwsh.exe'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 elseif executable('powershell.exe')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let g:ps1_makeprg_cmd = 'powershell.exe'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 else
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 let g:ps1_makeprg_cmd = ''
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 if !executable(g:ps1_makeprg_cmd)
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!"
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " Show CategoryInfo, FullyQualifiedErrorId, etc?
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0)
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 " Use absolute path because powershell requires explicit relative paths
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 " (./file.ps1 is okay, but # expands to file.ps1)
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 let &l:makeprg = g:ps1_makeprg_cmd .' %:p:S'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 " Parse file, line, char from callstacks:
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 " Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 " cmdlet, function, script file, or operable program. Check the spelling
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 " of the name, or if a path was included, verify that the path is correct
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 " and try again.
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 " At C:\script.ps1:11 char:5
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " + Write-Ouput $content
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 " + ~~~~~~~~~~~
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 " + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 " + FullyQualifiedErrorId : CommandNotFoundException
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 " Showing error in context with underlining.
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 CompilerSet errorformat=%+G+%m
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 " Error summary.
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 CompilerSet errorformat+=%E%*\\S\ :\ %m
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 " Error location.
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 CompilerSet errorformat+=%CAt\ %f:%l\ char:%c
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 " Errors that span multiple lines (may be wrapped to width of terminal).
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 CompilerSet errorformat+=%C%m
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 " Ignore blank/whitespace-only lines.
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 CompilerSet errorformat+=%Z\\s%#
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 if g:ps1_efm_show_error_categories
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 CompilerSet errorformat^=%+G\ \ \ \ +\ %.%#\\s%#:\ %m
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 else
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 CompilerSet errorformat^=%-G\ \ \ \ +\ %.%#\\s%#:\ %m
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 " Parse file, line, char from of parse errors:
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 " At C:\script.ps1:22 char:16
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 " + Stop-Process -Name "invalidprocess
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " + ~~~~~~~~~~~~~~~
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 " The string is missing the terminator: ".
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 " + CategoryInfo : ParserError: (:) [], ParseException
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 " + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 CompilerSet errorformat+=At\ %f:%l\ char:%c
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 let &cpo = s:cpo_save
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 unlet s:cpo_save
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 " vim:set sw=2 sts=2: