From 8dfe085c41954def22d75daeafae8017b9b6a667 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 12 Jul 2020 16:11:11 +0200 Subject: Add ts_utils.highlight_node --- .../refactor/highlight_definitions.lua | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'lua/nvim-treesitter/refactor/highlight_definitions.lua') diff --git a/lua/nvim-treesitter/refactor/highlight_definitions.lua b/lua/nvim-treesitter/refactor/highlight_definitions.lua index a581e37d..3b75cd84 100644 --- a/lua/nvim-treesitter/refactor/highlight_definitions.lua +++ b/lua/nvim-treesitter/refactor/highlight_definitions.lua @@ -24,29 +24,13 @@ function M.highlight_usages(bufnr) local usages = ts_utils.find_usages(node_at_point, scope) for _, usage_node in ipairs(usages) do - local start_row, start_col, _, end_col = usage_node:range() - if usage_node ~= node_at_point then - api.nvim_buf_add_highlight( - bufnr, - usage_namespace, - 'TSDefinitionUsage', - start_row, - start_col, - end_col) + ts_utils.highlight_node(node_at_point, bufnr, usage_namespace, 'TSDefinitionUsage') end end if def_node ~= node_at_point then - local start_row, start_col, _, end_col = def_node:range() - - api.nvim_buf_add_highlight( - bufnr, - usage_namespace, - 'TSDefinition', - start_row, - start_col, - end_col) + ts_utils.highlight_node(def_node, bufnr, usage_namespace, 'TSDefinition') end end -- cgit v1.2.3