summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/state.lua
diff options
context:
space:
mode:
authorkiyan42 <yazdani.kiyan@protonmail.com>2020-05-15 14:19:29 +0200
committerkiyan42 <yazdani.kiyan@protonmail.com>2020-05-15 14:19:29 +0200
commit8be2dc64a2e0a94a429d66c411eb7d500566508f (patch)
treed4000f95f0f472478036a89b19a2f55aadbb5fff /lua/nvim-treesitter/state.lua
parent5a66c38b9ff49f0f0b45afa95816c77e18cc9886 (diff)
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.
Diffstat (limited to 'lua/nvim-treesitter/state.lua')
-rw-r--r--lua/nvim-treesitter/state.lua8
1 files changed, 8 insertions, 0 deletions
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