runtime(indent-tests): Annotate timed "search*()"es for tracing
Commit:
https://github.com/vim/vim/commit/4e3df44aa2a4f99c3c35e11371f7f1b2b6207558
Author: Aliaksei Budavei <[email protected]>
Date: Sun Apr 13 21:00:42 2025 +0300
runtime(indent-tests): Annotate timed "search*()"es for tracing
related: https://github.com/vim/vim/issues/17116
Signed-off-by: Aliaksei Budavei <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/autoload/dist/vimindent.vim
b/runtime/autoload/dist/vimindent.vim
index 0681496ae..37f2ee5e1 100644
--- a/runtime/autoload/dist/vimindent.vim
+++ b/runtime/autoload/dist/vimindent.vim
@@ -2,7 +2,7 @@ vim9script
# Language: Vim script
# Maintainer: github user lacygoill
-# Last Change: 2024 Dec 26
+# Last Change: 2025 Apr 13
#
# Includes changes from The Vim Project:
# - 2024 Feb 09: Fix indent after literal Dict (A. Radev via #13966)
@@ -981,8 +981,10 @@ def SearchPair( # {{{3
if end == '[' || end == ']'
e = e->escape('[]')
endif
+ # VIM_INDENT_TEST_TRACE_START
return searchpair('\C' .. s, (middle == '' ? '' : '\C' .. middle), '\C' ..
e,
flags, (): bool => InCommentOrString(), stopline, TIMEOUT)
+ # VIM_INDENT_TEST_TRACE_END dist#vimindent#SearchPair
enddef
def SearchPairStart( # {{{3
@@ -1268,7 +1270,9 @@ def NonCommentedMatch(line: dict<any>, pat: string): bool
# {{{3
var pos: list<number> = getcurpos()
cursor(line.lnum, 1)
+ # VIM_INDENT_TEST_TRACE_START
var match_lnum: number = search(pat, 'cnW', line.lnum, TIMEOUT, (): bool
=> InCommentOrString())
+ # VIM_INDENT_TEST_TRACE_END dist#vimindent#NonCommentedMatch
setpos('.', pos)
return match_lnum > 0
enddef
diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim
index d5f486236..cf01198d7 100644
--- a/runtime/autoload/python.vim
+++ b/runtime/autoload/python.vim
@@ -20,10 +20,12 @@ let g:python_indent = extend(get(g:, 'python_indent', {}),
#{
let s:maxoff = 50 " maximum number of lines to look backwards for ()
function s:SearchBracket(fromlnum, flags)
+ " VIM_INDENT_TEST_TRACE_START
return searchpairpos('[[({]', '', '[])}]', a:flags,
\ {-> synstack('.', col('.'))
\ ->indexof({_, id -> synIDattr(id, 'name') =~
'\%(Comment\|Todo\|String\)$'}) >= 0},
\ [0, a:fromlnum - s:maxoff]->max(),
g:python_indent.searchpair_timeout)
+ " VIM_INDENT_TEST_TRACE_END python#s:SearchBracket
endfunction
" See if the specified line is already user-dedented from the expected value.
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index 2fa10cc91..671a4d197 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,7 +1,7 @@
" Vim indent script for HTML
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Original Author: Andy Wokula <[email protected]>
-" Last Change: 2023 Aug 13
+" Last Change: 2025 Apr 13
" Version: 1.0 "{{{
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -868,7 +868,9 @@ func HtmlIndent_FindTagStart(lnum)
let idx = match(getline(a:lnum), '\S>\s*$')
if idx > 0
call cursor(a:lnum, idx)
+ " VIM_INDENT_TEST_TRACE_START
let lnum = searchpair('<\w', '' , '\S>', 'bW', '', max([a:lnum -
b:html_indent_line_limit, 0]))
+ " VIM_INDENT_TEST_TRACE_END HtmlIndent_FindTagStart
if lnum > 0
return [lnum, 1]
endif
@@ -903,7 +905,9 @@ func HtmlIndent_FindTagEnd()
call search('--\zs>')
elseif s:get_tag('/' . tagname) != 0
" tag with a closing tag, find matching "</tag>"
+ " VIM_INDENT_TEST_TRACE_START
call searchpair('<' . tagname, '', '</' . tagname . '\zs>', 'W', '',
line('.') + b:html_indent_line_limit)
+ " VIM_INDENT_TEST_TRACE_END HtmlIndent_FindTagEnd
else
" self-closing tag, find the ">"
call search('\S\zs>')
diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim
index 8077442ed..6537d3f2f 100644
--- a/runtime/indent/javascript.vim
+++ b/runtime/indent/javascript.vim
@@ -2,7 +2,7 @@
" Language: Javascript
" Maintainer: Chris Paul ( https://github.com/bounceme )
" URL: https://github.com/pangloss/vim-javascript
-" Last Change: December 4, 2017
+" Last Change: 2025 Apr 13
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -69,7 +69,9 @@ let s:rel = has('reltime')
" searchpair() wrapper
if s:rel
function s:GetPair(start,end,flags,skip)
+ " VIM_INDENT_TEST_TRACE_START
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1,a:skip
==# 's:SkipFunc()' ? 2000 : 200)
+ " VIM_INDENT_TEST_TRACE_END s:GetPair
endfunction
else
function s:GetPair(start,end,flags,skip)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1u64l0-00CJkv-7H%40256bit.org.