diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-07-04 18:28:17 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-07-05 19:21:06 +0200 |
| commit | 5642507f6a35d2e25b1588a36d8ddfc525f1464d (patch) | |
| tree | d95ae24b0220deb9ce8674fea83fa6aba0747240 /lua/nvim-treesitter/refactor/highlight_definitions.lua | |
| parent | 1ce1c73249cf5620726f9b00fd58cac1747b1e70 (diff) | |
Make luacheck happy
Diffstat (limited to 'lua/nvim-treesitter/refactor/highlight_definitions.lua')
| -rw-r--r-- | lua/nvim-treesitter/refactor/highlight_definitions.lua | 17 |
1 files changed, 9 insertions, 8 deletions
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 <buffer=%d> lua require'nvim-treesitter.refactor.highlight_definitions'.highlight_usages(%d)]], bufnr, bufnr)) cmd(string.format([[autocmd CursorMoved <buffer=%d> lua require'nvim-treesitter.refactor.highlight_definitions'.clear_usage_highlights(%d)]], bufnr, bufnr)) cmd(string.format([[autocmd InsertEnter <buffer=%d> lua require'nvim-treesitter.refactor.highlight_definitions'.clear_usage_highlights(%d)]], bufnr, bufnr)) + -- luacheck: pop cmd 'augroup END' end |
