Skip to content

Commit

Permalink
runtime(vim): Fix indent after :silent! function
Browse files Browse the repository at this point in the history
See 35699f1#commitcomment-148816912

closes: #16009

Signed-off-by: Doug Kearns <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
dkearns authored and chrisbra committed Nov 10, 2024
1 parent 7c51528 commit 7724d62
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 4 additions & 3 deletions runtime/autoload/dist/vimindent.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ vim9script

# Language: Vim script
# Maintainer: github user lacygoill
# Last Change: 2023 Jun 29
# Last Change: 2024 Nov 08
#
# Includes Changes from Vim:
# Includes changes from The Vim Project:
# - 2024 Feb 09: Fix indent after literal Dict (A. Radev via #13966)
# - 2024 Nov 08: Fix indent after :silent! function (D. Kearns via #16009)

# NOTE: Whenever you change the code, make sure the tests are still passing:
#
Expand Down Expand Up @@ -295,7 +296,7 @@ patterns = []
endfor
}

const STARTS_NAMED_BLOCK: string = $'^\s*\%(sil\%[ent]\s\+\)\=\%({patterns->join('\|')}\)\>\%(\s\|$\|!\)\@='
const STARTS_NAMED_BLOCK: string = $'^\s*\%(sil\%[ent]!\=\s\+\)\=\%({patterns->join('\|')}\)\>\%(\s\|$\|!\)\@='

# STARTS_CURLY_BLOCK {{{3

Expand Down
9 changes: 9 additions & 0 deletions runtime/indent/testdir/vim.in
Original file line number Diff line number Diff line change
Expand Up @@ -951,3 +951,12 @@ endenum
call prop_type_add('indent_after_literal_dict', #{ foo: 'bar' })
call prop_type_delete('indent_after_literal_dict')
" END_INDENT

" START_INDENT
silent function Foo()
return 42
endfunction
silent! function Bar()
return 42
endfunction
" END_INDENT
9 changes: 9 additions & 0 deletions runtime/indent/testdir/vim.ok
Original file line number Diff line number Diff line change
Expand Up @@ -951,3 +951,12 @@ endenum
call prop_type_add('indent_after_literal_dict', #{ foo: 'bar' })
call prop_type_delete('indent_after_literal_dict')
" END_INDENT

" START_INDENT
silent function Foo()
return 42
endfunction
silent! function Bar()
return 42
endfunction
" END_INDENT

0 comments on commit 7724d62

Please sign in to comment.