From 056d3f5e9d25d8fad0c948b7d200fcede88cf00d Mon Sep 17 00:00:00 2001 From: Sasha Gurevich Date: Mon, 27 Jul 2026 13:33:06 +0300 Subject: [PATCH] Fix word matching in type hierarchy hightlighting --- lua/hopcsharp/hierarchy/buffer.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/hopcsharp/hierarchy/buffer.lua b/lua/hopcsharp/hierarchy/buffer.lua index cb32bf2..871041d 100644 --- a/lua/hopcsharp/hierarchy/buffer.lua +++ b/lua/hopcsharp/hierarchy/buffer.lua @@ -5,6 +5,10 @@ local M = {} local prefix = ' ' +local wrap_word_match = function(word) + return '\\<' .. word .. '\\>' +end + M.__get_hierarchy_buffer_name = function(type_name) return 'hopcsharp://hierarchy/' .. type_name end @@ -23,9 +27,9 @@ M.__create_hierarchy_buffer = function(type_name, tree_root) vim.api.nvim_create_autocmd('BufWinEnter', { callback = function() - vim.fn.matchadd('@lsp.type.enum', type_name) + vim.fn.matchadd('@lsp.type.enum', wrap_word_match(type_name)) for _, leaf_node in ipairs(leaf_nodes) do - vim.fn.matchadd('@lsp.type.enumMember', leaf_node) + vim.fn.matchadd('@lsp.type.enumMember', wrap_word_match(leaf_node)) end end, buffer = buf,