aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-09-25 08:37:05 -0400
committerGitHub <noreply@github.com>2022-09-25 08:37:05 -0400
commit4686bda06c9f3b7b309cfdc3782effdd465b4010 (patch)
treea661e738a9d53432878353e4eb9609444e8b1f05 /runtime
parent2a5692c64628ee0af3ef4931a774a2eb0a7e046f (diff)
parent1b60b5ec94001f18b70dbebf6c232c33209f11b5 (diff)
downloadrneovim-4686bda06c9f3b7b309cfdc3782effdd465b4010.tar.gz
rneovim-4686bda06c9f3b7b309cfdc3782effdd465b4010.tar.bz2
rneovim-4686bda06c9f3b7b309cfdc3782effdd465b4010.zip
Merge #20331 refactor(treesitter)!: rename x_position => x_pos
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/develop.txt6
-rw-r--r--runtime/doc/treesitter.txt6
-rw-r--r--runtime/lua/vim/treesitter.lua9
3 files changed, 12 insertions, 9 deletions
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index b31ac47bda..4f17e7d34a 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -251,6 +251,12 @@ Use existing common {action} names if possible:
list Get all things
set Set a thing (or group of things)
+Use existing common {thing} names if possible:
+ buf Buffer
+ pos Position
+ tab Tabpage
+ win Window
+
Use consistent names for {thing} in all API functions. E.g. a buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others.
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index eda1a5e496..3102c6da9a 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -434,8 +434,7 @@ get_captures_at_cursor({winnr}) *get_captures_at_cursor()*
Return: ~
string[] List of capture names
- *get_captures_at_position()*
-get_captures_at_position({bufnr}, {row}, {col})
+get_captures_at_pos({bufnr}, {row}, {col}) *get_captures_at_pos()*
Returns a list of highlight captures at the given position
Each capture is represented by a table containing the capture name as a
@@ -460,8 +459,7 @@ get_node_at_cursor({winnr}) *get_node_at_cursor()*
Return: ~
(string) Name of node under the cursor
- *get_node_at_position()*
-get_node_at_position({bufnr}, {row}, {col}, {opts})
+get_node_at_pos({bufnr}, {row}, {col}, {opts}) *get_node_at_pos()*
Returns the smallest named node at the given position
Parameters: ~
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 04e12cbe0b..6cd00516bf 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -202,7 +202,7 @@ end
---@param col number Position column
---
---@return table[] List of captures `{ capture = "capture name", metadata = { ... } }`
-function M.get_captures_at_position(bufnr, row, col)
+function M.get_captures_at_pos(bufnr, row, col)
if bufnr == 0 then
bufnr = a.nvim_get_current_buf()
end
@@ -258,7 +258,7 @@ function M.get_captures_at_cursor(winnr)
local bufnr = a.nvim_win_get_buf(winnr)
local cursor = a.nvim_win_get_cursor(winnr)
- local data = M.get_captures_at_position(bufnr, cursor[1] - 1, cursor[2])
+ local data = M.get_captures_at_pos(bufnr, cursor[1] - 1, cursor[2])
local captures = {}
@@ -278,7 +278,7 @@ end
--- - ignore_injections boolean Ignore injected languages (default true)
---
---@return userdata |tsnode| under the cursor
-function M.get_node_at_position(bufnr, row, col, opts)
+function M.get_node_at_pos(bufnr, row, col, opts)
if bufnr == 0 then
bufnr = a.nvim_get_current_buf()
end
@@ -302,8 +302,7 @@ function M.get_node_at_cursor(winnr)
local bufnr = a.nvim_win_get_buf(winnr)
local cursor = a.nvim_win_get_cursor(winnr)
- return M.get_node_at_position(bufnr, cursor[1] - 1, cursor[2], { ignore_injections = false })
- :type()
+ return M.get_node_at_pos(bufnr, cursor[1] - 1, cursor[2], { ignore_injections = false }):type()
end
--- Starts treesitter highlighting for a buffer