diff options
| author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-04-19 17:31:00 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <tomvig38@gmail.com> | 2020-04-19 17:31:00 +0200 |
| commit | 5783e7d2480663298055b86357829e61d4e27fab (patch) | |
| tree | 26941fe29df192fb53f563bf949970ef0891e3a7 /lua | |
| parent | fix(matches): better storage of nodes (diff) | |
| download | nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.tar nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.tar.gz nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.tar.bz2 nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.tar.lz nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.tar.xz nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.tar.zst nvim-treesitter-5783e7d2480663298055b86357829e61d4e27fab.zip | |
style: avoid overindenting things
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/locals.lua | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua index cd0c268db..d4a23d65a 100644 --- a/lua/nvim-treesitter/locals.lua +++ b/lua/nvim-treesitter/locals.lua @@ -17,23 +17,23 @@ end function M.collect_locals(bufnr) local ft = api.nvim_buf_get_option(bufnr, "ft") - if ft then - local query = queries.get_query(ft, 'locals') - local parser = parsers.get_parser(bufnr) + if not ft then return end - if parser then - local root = parser:parse():root() - local start_row, _, end_row, _ = root:range() + local query = queries.get_query(ft, 'locals') + local parser = parsers.get_parser(bufnr) - local locals = {} + if not parser then return end - for prepared_match in queries.iter_prepared_matches(query, root, bufnr, start_row, end_row) do - table.insert(locals, prepared_match) - end + local root = parser:parse():root() + local start_row, _, end_row, _ = root:range() - return locals - end + local locals = {} + + for prepared_match in queries.iter_prepared_matches(query, root, bufnr, start_row, end_row) do + table.insert(locals, prepared_match) end + + return locals end function M.on_lines(_, buf, _, firstline, lastline, new_lastline) |
