mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
Make luacheck happy
This commit is contained in:
parent
77f723acd7
commit
2c4a1d36d8
10 changed files with 23 additions and 43 deletions
|
|
@ -130,7 +130,7 @@ local function disable_mod_conf_autocmd(mod, lang)
|
|||
|
||||
if not config_mod or not M.is_enabled(mod, lang) then return end
|
||||
|
||||
local cmd = string.format("lua require'nvim-treesitter.%s'.attach()", mod)
|
||||
--local cmd = string.format("lua require'nvim-treesitter.%s'.attach()", mod)
|
||||
-- TODO(kyazdani): detach the correct autocmd... doesn't work when using %s, cmd
|
||||
for _, ft in pairs(parsers.lang_to_ft(lang)) do
|
||||
api.nvim_command(string.format("autocmd! NvimTreesitter FileType %s", ft))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
local api = vim.api
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
|
||||
local M = {}
|
||||
|
|
@ -21,7 +20,7 @@ function M.get_fold_indic(lnum)
|
|||
|
||||
local parser = parsers.get_parser()
|
||||
|
||||
local multiline_here, level = smallest_multiline_containing(parser:parse():root(), 0)
|
||||
local _, level = smallest_multiline_containing(parser:parse():root(), 0)
|
||||
|
||||
return tostring(level)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@ local api = vim.api
|
|||
local fn = vim.fn
|
||||
|
||||
local queries = require'nvim-treesitter.query'
|
||||
local locals = require'nvim-treesitter.locals'
|
||||
local highlight = require'nvim-treesitter.highlight'
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
|
||||
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']
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ local function select_incremental(get_parent)
|
|||
return
|
||||
end
|
||||
|
||||
node = get_parent(nodes[#nodes])
|
||||
local node = get_parent(nodes[#nodes])
|
||||
if not node then return end
|
||||
|
||||
if node ~= nodes[#nodes] then
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
-- Locals are a generalization of definition and scopes
|
||||
-- its the way nvim-treesitter uses to "understand" the code
|
||||
local api = vim.api
|
||||
local ts = vim.treesitter
|
||||
|
||||
local queries = require'nvim-treesitter.query'
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
-- This module highlights reference usages and the corresponding
|
||||
-- definition on cursor hold.
|
||||
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
local ts_utils = require'nvim-treesitter.ts_utils'
|
||||
local locals = require'nvim-treesitter.locals'
|
||||
local api = vim.api
|
||||
|
|
@ -60,9 +59,11 @@ function M.attach(bufnr)
|
|||
|
||||
cmd(string.format('augroup NvimTreesitterUsages_%d', bufnr))
|
||||
cmd 'au!'
|
||||
-- luacheck: push ignore 631
|
||||
cmd(string.format([[autocmd CursorHold <buffer=%d> lua require'nvim-treesitter.refactor.highlight_definitions'.highlight_usages(%d)]], bufnr, bufnr))
|
||||
cmd(string.format([[autocmd CursorMoved <buffer=%d> lua require'nvim-treesitter.refactor.highlight_definitions'.clear_usage_highlights(%d)]], bufnr, bufnr))
|
||||
cmd(string.format([[autocmd InsertEnter <buffer=%d> lua require'nvim-treesitter.refactor.highlight_definitions'.clear_usage_highlights(%d)]], bufnr, bufnr))
|
||||
-- luacheck: pop
|
||||
cmd 'augroup END'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,18 +7,6 @@ local api = vim.api
|
|||
|
||||
local M = {}
|
||||
|
||||
local function node_to_qf(node, kind)
|
||||
local lnum, col, _ = def.node:start()
|
||||
|
||||
return {
|
||||
bufnr = bufnr,
|
||||
lnum = lnum + 1,
|
||||
col = col + 1,
|
||||
text = ts_utils.get_node_text(def.node)[1] or '',
|
||||
kind = kind
|
||||
}
|
||||
end
|
||||
|
||||
function M.goto_definition(bufnr)
|
||||
local bufnr = bufnr or api.nvim_get_current_buf()
|
||||
local node_at_point = ts_utils.get_node_at_cursor()
|
||||
|
|
@ -70,10 +58,9 @@ function M.attach(bufnr)
|
|||
end
|
||||
|
||||
function M.detach(bufnr)
|
||||
local buf = bufnr or api.nvim_get_current_buf()
|
||||
local config = configs.get_module('refactor.navigation')
|
||||
|
||||
for fn_name, mapping in pairs(config.keymaps) do
|
||||
for _, mapping in pairs(config.keymaps) do
|
||||
api.nvim_buf_del_keymap(bufnr, 'n', mapping)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function M.smart_rename(bufnr)
|
|||
end
|
||||
|
||||
for _, node in ipairs(nodes_to_rename) do
|
||||
local start_row, start_col, end_row, end_col = node:range()
|
||||
local start_row, start_col, _, end_col = node:range()
|
||||
local line = api.nvim_buf_get_lines(bufnr, start_row, start_row + 1, false)[1]
|
||||
|
||||
if line then
|
||||
|
|
@ -56,10 +56,9 @@ function M.attach(bufnr)
|
|||
end
|
||||
|
||||
function M.detach(bufnr)
|
||||
local buf = bufnr or api.nvim_get_current_buf()
|
||||
local config = configs.get_module('refactor.smart_rename')
|
||||
|
||||
for fn_name, mapping in pairs(config.keymaps) do
|
||||
for _, mapping in pairs(config.keymaps) do
|
||||
api.nvim_buf_del_keymap(bufnr, 'n', mapping)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -222,7 +222,6 @@ function M.find_definition(node, bufnr)
|
|||
local bufnr = bufnr or api.nvim_get_current_buf()
|
||||
local node_text = M.get_node_text(node)[1]
|
||||
local current_scope = M.containing_scope(node)
|
||||
local _, _, node_start = node:start()
|
||||
local matching_def_nodes = {}
|
||||
|
||||
-- If a scope wasn't found then use the root node
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
local luv = vim.loop
|
||||
local ts = vim.treesitter
|
||||
|
||||
local M = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue