runtime(hare): update for Hare 0.25.2
closes: #18222 Signed-off-by: Amelia Clarke <selene@perilune.dev> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
6bb16d2cee
commit
6d68508e62
32
runtime/autoload/dist/ft.vim
vendored
32
runtime/autoload/dist/ft.vim
vendored
@ -3,7 +3,7 @@ vim9script
|
||||
# Vim functions for file type detection
|
||||
#
|
||||
# Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
# Last Change: 2025 Sep 04
|
||||
# Last Change: 2025 Sep 08
|
||||
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
|
||||
# These functions are moved here from runtime/filetype.vim to make startup
|
||||
@ -441,29 +441,29 @@ export def FTfs()
|
||||
endif
|
||||
enddef
|
||||
|
||||
# Recursively search for Hare source files in a directory and any
|
||||
# subdirectories, up to a given depth.
|
||||
# Recursively searches for Hare source files within a directory, up to a given
|
||||
# depth.
|
||||
def IsHareModule(dir: string, depth: number): bool
|
||||
if depth <= 0
|
||||
return !empty(glob(dir .. '/*.ha'))
|
||||
if depth < 1
|
||||
return false
|
||||
elseif depth == 1
|
||||
return !glob(dir .. '/*.ha')->empty()
|
||||
endif
|
||||
|
||||
return reduce(sort(glob(dir .. '/*', true, true),
|
||||
(a, b) => isdirectory(a) - isdirectory(b)),
|
||||
(acc, n) => acc
|
||||
# Check all files in the directory before recursing into subdirectories.
|
||||
return glob(dir .. '/*', true, true)
|
||||
->sort((a, b) => isdirectory(a) - isdirectory(b))
|
||||
->reduce((acc, n) => acc
|
||||
|| n =~ '\.ha$'
|
||||
|| isdirectory(n)
|
||||
&& IsHareModule(n, depth - 1),
|
||||
|| isdirectory(n) && IsHareModule(n, depth - 1),
|
||||
false)
|
||||
enddef
|
||||
|
||||
# Determine if a README file exists within a Hare module and should be given the
|
||||
# Haredoc filetype.
|
||||
# Determines whether a README file is inside a Hare module and should receive
|
||||
# the 'haredoc' filetype.
|
||||
export def FTharedoc()
|
||||
if exists('g:filetype_haredoc')
|
||||
if IsHareModule('<afile>:h', get(g:, 'haredoc_search_depth', 1))
|
||||
setf haredoc
|
||||
endif
|
||||
if IsHareModule('<afile>:h', get(g:, 'filetype_haredoc', 1))
|
||||
setf haredoc
|
||||
endif
|
||||
enddef
|
||||
|
||||
|
||||
Reference in New Issue
Block a user