From 78b40f895cb2bf789944f94abd47dd7f7ab3f8dc Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Thu, 23 Apr 2020 07:55:00 +0200 Subject: textobj: add incremental node selection --- lua/nvim-treesitter/locals.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lua/nvim-treesitter/locals.lua') diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua index 388c7e48..1e19fcd4 100644 --- a/lua/nvim-treesitter/locals.lua +++ b/lua/nvim-treesitter/locals.lua @@ -68,8 +68,8 @@ function M.get_definitions(bufnr) local defs = {} for _, loc in ipairs(locals) do - if loc.definition then - table.insert(defs, {definition=loc.definition, kind=loc.kind}) + if loc.definition and loc.definition.node then + table.insert(defs, {node=loc.definition.node, kind=loc.kind}) end end @@ -82,8 +82,8 @@ function M.get_scopes(bufnr) local scopes = {} for _, loc in ipairs(locals) do - if loc.scope then - table.insert(scopes, loc.scope) + if loc.scope and loc.scope.node then + table.insert(scopes, loc.scope.node) end end @@ -96,8 +96,8 @@ function M.get_references(bufnr) local refs = {} for _, loc in ipairs(locals) do - if loc.reference then - table.insert(refs, loc.reference) + if loc.reference and loc.reference.node then + table.insert(refs, loc.reference.node) end end -- cgit v1.2.3 From ce690e550d0905a9c4f177064e709f5e22d95fe8 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Sun, 26 Apr 2020 15:38:32 +0200 Subject: health(refactor): move checks inside health.lua --- lua/nvim-treesitter/locals.lua | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'lua/nvim-treesitter/locals.lua') diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua index 1e19fcd4..3e517454 100644 --- a/lua/nvim-treesitter/locals.lua +++ b/lua/nvim-treesitter/locals.lua @@ -10,22 +10,6 @@ local M = { locals={} } -function M.checkhealth(lang) - local health_start = vim.fn["health#report_start"] - local health_ok = vim.fn['health#report_ok'] - local health_info = vim.fn['health#report_info'] - local health_warn = vim.fn['health#report_warn'] - local health_error = vim.fn['health#report_error'] - - if not queries.get_query(lang, "locals") then - health_warn("No `locals.scm` query found for " .. lang, { - "Open an issue at https://github.com/nvim-treesitter/nvim-treesitter" - }) - else - health_ok("`locals.scm` found.") - end -end - function M.collect_locals(bufnr) local ft = api.nvim_buf_get_option(bufnr, "ft") if not ft then return end -- cgit v1.2.3 From 824b063d0d518dd20e09585604e923139599128f Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Thu, 7 May 2020 09:20:40 +0200 Subject: fix: change locals extraction --- lua/nvim-treesitter/locals.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lua/nvim-treesitter/locals.lua') diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua index 3e517454..b16408ac 100644 --- a/lua/nvim-treesitter/locals.lua +++ b/lua/nvim-treesitter/locals.lua @@ -52,8 +52,8 @@ function M.get_definitions(bufnr) local defs = {} for _, loc in ipairs(locals) do - if loc.definition and loc.definition.node then - table.insert(defs, {node=loc.definition.node, kind=loc.kind}) + if loc.definition then + table.insert(defs, loc.definition) end end -- cgit v1.2.3