From 5642507f6a35d2e25b1588a36d8ddfc525f1464d Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 4 Jul 2020 18:28:17 +0200 Subject: Make luacheck happy --- lua/nvim-treesitter/refactor/highlight_definitions.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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 bdbec158..a581e37d 100644 --- a/lua/nvim-treesitter/refactor/highlight_definitions.lua +++ b/lua/nvim-treesitter/refactor/highlight_definitions.lua @@ -1,7 +1,6 @@ -- This module highlights reference usages and the corresponding -- definition on cursor hold. -local parsers = require'nvim-treesitter.parsers' local ts_utils = require'nvim-treesitter.ts_utils' local locals = require'nvim-treesitter.locals' local api = vim.api @@ -17,7 +16,7 @@ function M.highlight_usages(bufnr) local node_at_point = ts_utils.get_node_at_cursor() local references = locals.get_references(bufnr) - if not node_at_point or not vim.tbl_contains(references, node_at_point) then + if not node_at_point or not vim.tbl_contains(references, node_at_point) then return end @@ -29,9 +28,9 @@ function M.highlight_usages(bufnr) if usage_node ~= node_at_point then api.nvim_buf_add_highlight( - bufnr, - usage_namespace, - 'TSDefinitionUsage', + bufnr, + usage_namespace, + 'TSDefinitionUsage', start_row, start_col, end_col) @@ -42,9 +41,9 @@ function M.highlight_usages(bufnr) local start_row, start_col, _, end_col = def_node:range() api.nvim_buf_add_highlight( - bufnr, - usage_namespace, - 'TSDefinition', + bufnr, + usage_namespace, + 'TSDefinition', start_row, start_col, end_col) @@ -60,9 +59,11 @@ function M.attach(bufnr) cmd(string.format('augroup NvimTreesitterUsages_%d', bufnr)) cmd 'au!' + -- luacheck: push ignore 631 cmd(string.format([[autocmd CursorHold lua require'nvim-treesitter.refactor.highlight_definitions'.highlight_usages(%d)]], bufnr, bufnr)) cmd(string.format([[autocmd CursorMoved lua require'nvim-treesitter.refactor.highlight_definitions'.clear_usage_highlights(%d)]], bufnr, bufnr)) cmd(string.format([[autocmd InsertEnter lua require'nvim-treesitter.refactor.highlight_definitions'.clear_usage_highlights(%d)]], bufnr, bufnr)) + -- luacheck: pop cmd 'augroup END' end -- cgit v1.2.3