diff options
| author | Santos Gallegos <stsewd@protonmail.com> | 2021-04-07 19:23:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-07 19:23:14 -0500 |
| commit | 5f53f55371ff067c86099723497a5ecd06475b33 (patch) | |
| tree | 94a40fbe41b1b4acf47d3b1011d238ee2babc807 /lua | |
| parent | Update lockfile.json (diff) | |
| download | nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.tar nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.tar.gz nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.tar.bz2 nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.tar.lz nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.tar.xz nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.tar.zst nvim-treesitter-5f53f55371ff067c86099723497a5ecd06475b33.zip | |
Fix usage of string.sub (#1164)
From https://www.lua.org/pil/20.html
> The call string.sub(s,i,j) extracts a piece of the string s, from the i-th to the j-th character inclusive.
This was breaking textobjects movement.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/query.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lua/nvim-treesitter/query.lua b/lua/nvim-treesitter/query.lua index 6bcc5687d..9c929defa 100644 --- a/lua/nvim-treesitter/query.lua +++ b/lua/nvim-treesitter/query.lua @@ -169,7 +169,7 @@ end -- Works like M.get_references or M.get_scopes except you can choose the capture -- Can also be a nested capture like @definition.function to get all nodes defining a function function M.get_capture_matches(bufnr, capture_string, query_group, root, lang) - if not string.sub(capture_string, 1,2) == '@' then + if not string.sub(capture_string, 1, 1) == '@' then print('capture_string must start with "@"') return end @@ -189,7 +189,7 @@ function M.get_capture_matches(bufnr, capture_string, query_group, root, lang) end function M.find_best_match(bufnr, capture_string, query_group, filter_predicate, scoring_function, root) - if string.sub(capture_string, 1,2) == '@' then + if string.sub(capture_string, 1, 1) == '@' then --remove leading "@" capture_string = string.sub(capture_string, 2) end |
