From 0ecca23ee2449304f138090eee5e15d512d1cceb Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi Date: Wed, 2 Sep 2026 23:01:54 +0200 Subject: [PATCH] fix(treesitter): accept a string title in inspect_tree() #41639 Problem: `inspect_tree()` documents `title` as `string|fun(bufnr:integer):string|nil`, but the implementation handles only `nil` and function values. A string title leaves `title` unset and fails the assertion below. Solution: Use the string as the title. --- runtime/lua/vim/treesitter/dev.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 32cd13ae3d..0eaff2e554 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -391,6 +391,8 @@ function M.inspect_tree(opts) title = ('Syntax tree for %s'):format(vim.fs.relpath('.', bufname) or bufname) elseif type(opts_title) == 'function' then title = opts_title(buf) + else + title = opts_title end assert(type(title) == 'string', 'Window title must be a string')