From 8be2dc64a2e0a94a429d66c411eb7d500566508f Mon Sep 17 00:00:00 2001 From: kiyan42 Date: Fri, 15 May 2020 14:19:29 +0200 Subject: Expose internal api. - add `exposed_state` to expose 'current_node' and 'cursor_pos' for a current buffer to the user. - add `get_buf_state` and `get_node_api` for users. - add documentation about api functions. - remove `node_movement` module which should be done in user side. --- lua/nvim-treesitter/state.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lua/nvim-treesitter/state.lua') diff --git a/lua/nvim-treesitter/state.lua b/lua/nvim-treesitter/state.lua index 9da07ae1..d682bd28 100644 --- a/lua/nvim-treesitter/state.lua +++ b/lua/nvim-treesitter/state.lua @@ -111,4 +111,12 @@ function M.get_buf_state(bufnr) return buffers[bufnr] end +function M.exposed_state(bufnr) + local buf_state = buffers[bufnr] + return { + cursor_pos = buf_state.cursor_pos, + current_node = buf_state.current_node + } +end + return M -- cgit v1.2.3