Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into tabsidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtnn committed Dec 27, 2024
2 parents ba1926c + 2e25247 commit e37ba0d
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 19 deletions.
1 change: 1 addition & 0 deletions runtime/autoload/dist/ft.vim
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ export def SetFileTypeSH(name: string, setft = true): string
if exists("b:is_sh")
unlet b:is_sh
endif
return SetFileTypeShell("bash", setft)
elseif name =~ '\<sh\>' || name =~ '\<dash\>'
# Ubuntu links "sh" to "dash", thus it is expected to work the same way
b:is_sh = 1
Expand Down
12 changes: 12 additions & 0 deletions runtime/compiler/bash.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
" Vim compiler file
" Compiler: Bash Syntax Checker
" Maintainer: @konfekt
" Last Change: 2024 Dec 27

if exists("current_compiler")
finish
endif
let current_compiler = "bash"

CompilerSet makeprg=bash\ -n
CompilerSet errorformat=%f:\ line\ %l:\ %m
4 changes: 2 additions & 2 deletions runtime/compiler/spotbugs.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: Spotbugs (Java static checker; needs javac compiled classes)
" Maintainer: @konfekt and @zzzyxwvut
" Last Change: 2024 Dec 14
" Maintainers: @konfekt and @zzzyxwvut
" Last Change: 2024 Dec 20

if exists('g:current_compiler') || bufname() !~# '\.java\=$' || wordcount().chars < 9
finish
Expand Down
66 changes: 65 additions & 1 deletion runtime/doc/quickfix.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 9.1. Last change: 2024 Dec 16
*quickfix.txt* For Vim version 9.1. Last change: 2024 Dec 27


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -1424,6 +1424,70 @@ of |:make|, and assigning its |Funcref| to the selected key. For example:
\ function('GenericPostCompilerCommand'),
\ }

When "PostCompilerAction" is available, "PostCompilerActionExecutor" is also
supported. Its value must be a Funcref pointing to a function that always
declares a single parameter of type string and decides whether |:execute| can
be dispatched on its argument, containing a pending post-compiler action,
after ascertaining the current status of |:cc| (or |:ll|): >vim

function! GenericPostCompilerActionExecutor(action) abort
try
cc
catch /\<E42:/
execute a:action
endtry
endfunction

Complementary, some or all of the available "Pre*Action"s (or "*Pre*Command"s)
may run `:doautocmd java_spotbugs_post User` in their implementations before
|:make| (or its equivalent) to define a once-only |ShellCmdPost| `:autocmd`
that will arrange for "PostCompilerActionExecutor" to be invoked; and then run
`:doautocmd java_spotbugs_post ShellCmdPost` to consume this event: >vim

function! GenericPreCompilerCommand(arguments) abort
if !exists('g:spotbugs_compilation_done')
doautocmd java_spotbugs_post User
execute 'make ' . a:arguments
" only run doautocmd when :make was synchronous
" see note below
doautocmd java_spotbugs_post ShellCmdPost " XXX: (a)
let g:spotbugs_compilation_done = 1
else
cc
endif
endfunction

function! GenericPreCompilerTestCommand(arguments) abort
if !exists('g:spotbugs_test_compilation_done')
doautocmd java_spotbugs_post User
execute 'make ' . a:arguments
" only run doautocmd when :make was synchronous
" see note below
doautocmd java_spotbugs_post ShellCmdPost " XXX: (b)
let g:spotbugs_test_compilation_done = 1
else
cc
endif
endfunction

let g:spotbugs_properties = {
\ 'compiler': 'maven',
\ 'DefaultPreCompilerCommand':
\ function('GenericPreCompilerCommand'),
\ 'DefaultPreCompilerTestCommand':
\ function('GenericPreCompilerTestCommand'),
\ 'PostCompilerActionExecutor':
\ function('GenericPostCompilerActionExecutor'),
\ }

If a command equivalent of `:make` is capable of asynchronous execution and
consuming `ShellCmdPost` events, `:doautocmd java_spotbugs_post ShellCmdPost`
must be removed from such "*Action" (or "*Command") implementations (i.e. the
lines `(a)` and `(b)` in the listed examples) to retain a sequential order for
non-blocking execution, and any notification (see below) must be suppressed.
A `ShellCmdPost` `:autocmd` can be associated with any |:augroup| by assigning
its name to the "augroupForPostCompilerAction" key.

When default actions are not suited to a desired workflow, proceed by writing
arbitrary functions yourself and matching their Funcrefs to the supported
keys: "PreCompilerAction", "PreCompilerTestAction", and "PostCompilerAction".
Expand Down
46 changes: 41 additions & 5 deletions runtime/ftplugin/java.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
" Former Maintainer: Dan Sharp
" Repository: https://github.com/zzzyxwvut/java-vim.git
" Last Change: 2024 Dec 16
" Last Change: 2024 Dec 25
" 2024 Jan 14 by Vim Project (browsefilter)
" 2024 May 23 by Riley Bruins <[email protected]> ('commentstring')

Expand Down Expand Up @@ -113,7 +113,7 @@ if (!empty(get(g:, 'spotbugs_properties', {})) ||
endfunction

" Work around ":bar"s and ":autocmd"s.
function! s:ExecuteActionOnce(cleanup_cmd, action_cmd) abort
function! JavaFileTypeExecuteActionOnce(cleanup_cmd, action_cmd) abort
try
execute a:cleanup_cmd
finally
Expand Down Expand Up @@ -285,7 +285,7 @@ if (!empty(get(g:, 'spotbugs_properties', {})) ||
for s:action in s:actions
if has_key(s:action, 'once')
execute printf('autocmd java_spotbugs %s <buffer> ' .
\ 'call s:ExecuteActionOnce(%s, %s)',
\ 'call JavaFileTypeExecuteActionOnce(%s, %s)',
\ s:action.event,
\ string(printf('autocmd! java_spotbugs %s <buffer>',
\ s:action.event)),
Expand All @@ -297,7 +297,41 @@ if (!empty(get(g:, 'spotbugs_properties', {})) ||
endif
endfor

unlet! s:action s:actions s:idx s:dispatcher
if s:SpotBugsHasProperty('PostCompilerActionExecutor') &&
\ (s:request == 7 || s:request == 6 ||
\ s:request == 5 || s:request == 4)
let s:augroup = s:SpotBugsGetProperty(
\ 'augroupForPostCompilerAction',
\ 'java_spotbugs_post')
let s:augroup = !empty(s:augroup) ? s:augroup : 'java_spotbugs_post'

for s:candidate in ['java_spotbugs_post', s:augroup]
if !exists("#" . s:candidate)
execute printf('augroup %s | augroup END', s:candidate)
endif
endfor

silent! autocmd! java_spotbugs_post User <buffer>

" Define a User ":autocmd" to define a once-only ShellCmdPost
" ":autocmd" that will invoke "PostCompilerActionExecutor" and let
" it decide whether to proceed with ":compiler spotbugs" etc.; and
" seek explicit synchronisation with ":doautocmd ShellCmdPost" by
" omitting "nested" for "java_spotbugs_post" and "java_spotbugs".
execute printf('autocmd java_spotbugs_post User <buffer> ' .
\ 'call JavaFileTypeExecuteActionOnce(%s, %s)',
\ string(printf('autocmd! %s ShellCmdPost <buffer>', s:augroup)),
\ string(printf('autocmd %s ShellCmdPost <buffer> ' .
\ 'call JavaFileTypeExecuteActionOnce(%s, %s)',
\ s:augroup,
\ string(printf('autocmd! %s ShellCmdPost <buffer>', s:augroup)),
\ string(printf('call call(%s, [%s])',
\ string(s:SpotBugsGetProperties().PostCompilerActionExecutor),
\ string(printf('compiler spotbugs | call call(%s, [])',
\ string(s:SpotBugsGetProperties().PostCompilerAction))))))))
endif

unlet! s:candidate s:augroup s:action s:actions s:idx s:dispatcher
endif

delfunction s:SpotBugsGetProperties
Expand All @@ -310,9 +344,11 @@ function! JavaFileTypeCleanUp() abort
setlocal suffixes< suffixesadd< formatoptions< comments< commentstring< path< includeexpr<
unlet! b:browsefilter

" The concatenated removals may be misparsed as a User autocmd.
" The concatenated ":autocmd" removals may be misparsed as an ":autocmd".
" A _once-only_ ShellCmdPost ":autocmd" is always a call-site definition.
silent! autocmd! java_spotbugs User <buffer>
silent! autocmd! java_spotbugs Syntax <buffer>
silent! autocmd! java_spotbugs_post User <buffer>
endfunction

" Undo the stuff we changed.
Expand Down
4 changes: 2 additions & 2 deletions src/INSTALLpc.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INSTALLpc.txt - Installation of Vim on PC - Last Update: 2024 Dec 26
INSTALLpc.txt - Installation of Vim on PC - Last Update: 2024 Dec 27

This file contains instructions for compiling Vim. If you already have an
executable version of Vim, you don't need this.
Expand Down Expand Up @@ -367,7 +367,7 @@ and you type:

Note, ARCH is necessary if you don't have the sed command in your $PATH. Just
make sure that the correct value is used with ARCH. In the example above the
value corresponds to 64-bit architecture. For 32-bit the value is x86.
value corresponds to 64-bit architecture. For 32-bit the value is "i686".

After churning for a while, you will end up with 'gvim.exe' in the 'vim\src'
directory.
Expand Down
2 changes: 1 addition & 1 deletion src/ex_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ EXCMD(CMD_enew, "enew", ex_edit,
EX_BANG|EX_TRLBAR,
ADDR_NONE),
EXCMD(CMD_enum, "enum", ex_class,
EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_WHOLE|EX_EXPORT,
ADDR_NONE),
EXCMD(CMD_eval, "eval", ex_eval,
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
Expand Down
64 changes: 63 additions & 1 deletion src/testdir/test_compiler.vim
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,22 @@ func Test_compiler_spotbugs_properties()
endfunc
defer execute('delfunction g:SpotBugsPostCommand')

func! g:SpotBugsPostCompilerActionExecutor(action) abort
try
" XXX: Notify the spotbugs compiler about success or failure.
cc
catch /\<E42:/
execute a:action
endtry
endfunc
defer execute('delfunction g:SpotBugsPostCompilerActionExecutor')

" TEST INTEGRATION WITH A SUPPORTED COMPILER PLUGIN.
if filereadable($VIMRUNTIME .. '/compiler/maven.vim')
if !executable('mvn')
if has('win32')
" This is what ":help executable()" suggests.
call writefile([], 'Xspotbugs/mvn.exe')
call writefile([], 'Xspotbugs/mvn.cmd')
else
let $PATH = 'Xspotbugs:' .. $PATH
call writefile([], 'Xspotbugs/mvn')
Expand Down Expand Up @@ -592,6 +602,8 @@ func Test_compiler_spotbugs_properties()
\ 'DefaultPreCompilerTestCommand': function('g:SpotBugsPreTestCommand'),
\ 'DefaultPreCompilerCommand': function('g:SpotBugsPreCommand'),
\ 'DefaultPostCompilerCommand': function('g:SpotBugsPostCommand'),
\ 'PostCompilerActionExecutor': function('g:SpotBugsPostCompilerActionExecutor'),
\ 'augroupForPostCompilerAction': 'java_spotbugs_test',
\ 'sourceDirPath': ['Xspotbugs/src'],
\ 'classDirPath': ['Xspotbugs/src'],
\ 'testSourceDirPath': ['tests'],
Expand Down Expand Up @@ -638,6 +650,56 @@ func Test_compiler_spotbugs_properties()
call assert_match('^spotbugs\s', &l:makeprg)
endif

setlocal makeprg=
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionOtherDone = 0
let s:spotbugs_results.preTestLocalActionDone = 0
let s:spotbugs_results.postActionDone = 0
let s:spotbugs_results.preCommandArguments = ''
let s:spotbugs_results.preTestCommandArguments = ''
let s:spotbugs_results.postCommandArguments = ''

" When "PostCompilerActionExecutor", "Pre*Action" and/or "Pre*TestAction",
" and "Post*Action" are available, "#java_spotbugs_post" must be defined.
call assert_true(exists('#java_spotbugs_post'))
call assert_true(exists('#java_spotbugs_post#User'))
call assert_false(exists('#java_spotbugs_post#ShellCmdPost'))
call assert_false(exists('#java_spotbugs_test#ShellCmdPost'))

" Re-link a Funcref on the fly.
func! g:SpotBugsPreTestCommand(arguments) abort
let s:spotbugs_results.preTestActionOtherDone = 1
let s:spotbugs_results.preTestCommandArguments = a:arguments
" Define a once-only ":autocmd" for "#java_spotbugs_test#ShellCmdPost".
doautocmd java_spotbugs_post User
" XXX: Do NOT use ":cc" to notify the spotbugs compiler about success or
" failure, and assume the transfer of control to a ShellCmdPost command.
endfunc

doautocmd java_spotbugs User
" No match: "test_file !~# 'Xspotbugs/src'".
call assert_false(s:spotbugs_results.preActionDone)
call assert_true(empty(s:spotbugs_results.preCommandArguments))
" A match: "test_file =~# 'tests'".
call assert_true(s:spotbugs_results.preTestActionOtherDone)
call assert_equal('test-compile', s:spotbugs_results.preTestCommandArguments)
" For a pre-match, no post-action (without ":cc") UNLESS a ShellCmdPost
" event is consumed whose command will invoke "PostCompilerActionExecutor"
" and the latter will accept a post-compiler action argument.
call assert_false(s:spotbugs_results.postActionDone)
call assert_true(exists('#java_spotbugs_test#ShellCmdPost'))
doautocmd ShellCmdPost
call assert_false(exists('#java_spotbugs_test#ShellCmdPost'))
call assert_true(s:spotbugs_results.postActionDone)
call assert_equal('%:S', s:spotbugs_results.postCommandArguments)

" With a match, confirm that ":compiler spotbugs" has run.
if has('win32')
call assert_match('^spotbugs\.bat\s', &l:makeprg)
else
call assert_match('^spotbugs\s', &l:makeprg)
endif

bwipeout
setlocal makeprg=
endif
Expand Down
19 changes: 12 additions & 7 deletions src/testdir/test_filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def s:GetFilenameChecks(): dict<list<string>>
awk: ['file.awk', 'file.gawk'],
b: ['file.mch', 'file.ref', 'file.imp'],
basic: ['file.bas', 'file.bi', 'file.bm'],
bash: ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout',
'.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history',
'.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD',
'file.bash', 'file.bats', 'file.cygport'],
bass: ['file.bass'],
bc: ['file.bc'],
bdf: ['file.bdf'],
Expand Down Expand Up @@ -685,11 +689,12 @@ def s:GetFilenameChecks(): dict<list<string>>
services: ['/etc/services', 'any/etc/services'],
setserial: ['/etc/serial.conf', 'any/etc/serial.conf'],
sexplib: ['file.sexp'],
sh: ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history',
'/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh',
'/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile',
'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf',
'.devscripts', 'file.lo', 'file.la', 'file.lai'],
sh: ['/usr/share/doc/bash-completion/filter.sh',
'/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf',
'.ash_history', 'any/etc/neofetch/config.conf', '.xprofile',
'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf',
'file.mdd', '.env', '.envrc', 'devscripts.conf', '.devscripts', 'file.lo',
'file.la', 'file.lai'],
sieve: ['file.siv', 'file.sieve'],
sil: ['file.sil'],
simula: ['file.sim'],
Expand Down Expand Up @@ -984,11 +989,11 @@ def s:GetScriptChecks(): dict<list<list<string>>>
clojure: [['#!/path/clojure']],
scala: [['#!/path/scala']],
sh: [['#!/path/sh'],
['#!/path/bash'],
['#!/path/bash2'],
['#!/path/dash'],
['#!/path/ksh'],
['#!/path/ksh93']],
bash: [['#!/path/bash'],
['#!/path/bash2']],
csh: [['#!/path/csh']],
tcsh: [['#!/path/tcsh']],
zsh: [['#!/path/zsh']],
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/test_vim9_enum.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def Test_enum_parse()
END
v9.CheckSourceFailure(lines, 'E492: Not an editor command: enums Something', 2)

# The complete "enum" should be specified.
lines =<< trim END
vim9script
enu Something
endenum
END
v9.CheckSourceFailure(lines, 'E1065: Command cannot be shortened: enu', 2)

# The complete "endenum" should be specified.
lines =<< trim END
vim9script
Expand Down
6 changes: 6 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
967,
/**/
966,
/**/
965,
/**/
964,
/**/
Expand Down

0 comments on commit e37ba0d

Please sign in to comment.