summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/refactor/highlight_current_scope.lua
diff options
context:
space:
mode:
authorSteven Sojka <Steven.Sojka@tdameritrade.com>2020-09-16 07:03:22 -0500
committerSteven Sojka <steelsojka@gmail.com>2020-09-25 10:30:35 -0500
commit82a8b859c6377a03e0c4d33b8b045548568c7aef (patch)
treeb9a2acd3adf5bb32f7a48951e92409d5b2bdf9b4 /lua/nvim-treesitter/refactor/highlight_current_scope.lua
parent98c12ec23a6df2f2f505304b61c4b2eefc0a568f (diff)
chore(modules): remove refactor module
Diffstat (limited to 'lua/nvim-treesitter/refactor/highlight_current_scope.lua')
-rw-r--r--lua/nvim-treesitter/refactor/highlight_current_scope.lua45
1 files changed, 0 insertions, 45 deletions
diff --git a/lua/nvim-treesitter/refactor/highlight_current_scope.lua b/lua/nvim-treesitter/refactor/highlight_current_scope.lua
deleted file mode 100644
index e4528615..00000000
--- a/lua/nvim-treesitter/refactor/highlight_current_scope.lua
+++ /dev/null
@@ -1,45 +0,0 @@
--- This module highlights the current scope of at the cursor position
-
-local ts_utils = require'nvim-treesitter.ts_utils'
-local locals = require'nvim-treesitter.locals'
-local api = vim.api
-local cmd = api.nvim_command
-
-local M = {}
-
-local current_scope_namespace = api.nvim_create_namespace('nvim-treesitter-current-scope')
-
-function M.highlight_current_scope(bufnr)
- M.clear_highlights(bufnr)
-
- local node_at_point = ts_utils.get_node_at_cursor()
- local current_scope = locals.containing_scope(node_at_point, bufnr)
-
- local start_line = current_scope:start()
-
- if current_scope and start_line ~= 0 then
- ts_utils.highlight_node(current_scope, bufnr, current_scope_namespace, 'TSCurrentScope')
- end
-end
-
-function M.clear_highlights(bufnr)
- api.nvim_buf_clear_namespace(bufnr, current_scope_namespace, 0, -1)
-end
-
-function M.attach(bufnr)
- cmd(string.format('augroup NvimTreesitterCurrentScope_%d', bufnr))
- cmd 'au!'
- -- luacheck: push ignore 631
- cmd(string.format([[autocmd CursorMoved <buffer=%d> lua require'nvim-treesitter.refactor.highlight_current_scope'.highlight_current_scope(%d)]], bufnr, bufnr))
- cmd(string.format([[autocmd BufLeave <buffer=%d> lua require'nvim-treesitter.refactor.highlight_current_scope'.clear_highlights(%d)]], bufnr, bufnr))
- -- luacheck: pop
- cmd 'augroup END'
-end
-
-function M.detach(bufnr)
- M.clear_highlights(bufnr)
- cmd(string.format('autocmd! NvimTreesitterCurrentScope_%d CursorMoved', bufnr))
- cmd(string.format('autocmd! NvimTreesitterCurrentScope_%d BufLeave', bufnr))
-end
-
-return M