commit f8e1ebd6f62662129fdb54574b305189e4a0b7af
parent d9ccd828b0d46754b9bcb9b17f47c2a51968db05
Author: Riley Bruins <ribru17@hotmail.com>
Date: Mon, 26 Aug 2024 20:40:37 -0700
fix(treesitter): escape things like `"` in omnifunc results
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runtime/lua/vim/treesitter/_query_linter.lua b/runtime/lua/vim/treesitter/_query_linter.lua
@@ -241,7 +241,7 @@ function M.omnifunc(findstart, base)
end
end
for _, s in pairs(parser_info.symbols) do
- local text = s[2] and s[1] or '"' .. s[1]:gsub([[\]], [[\\]]) .. '"' ---@type string
+ local text = s[2] and s[1] or string.format('%q', s[1]):gsub('\n', 'n') ---@type string
if text:find(base, 1, true) then
table.insert(items, text)
end