chore: add stylua to format the codebase, and run on CI (#1055)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
local view = require'nvim-tree.view'
|
||||
local utils = require'nvim-tree.utils'
|
||||
local renderer = require"nvim-tree.renderer"
|
||||
local view = require "nvim-tree.view"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local renderer = require "nvim-tree.renderer"
|
||||
|
||||
local M = {}
|
||||
|
||||
local function get_index_offset()
|
||||
local hide_root_folder = view.View.hide_root_folder
|
||||
if TreeExplorer.cwd == '/' or hide_root_folder then
|
||||
if TreeExplorer.cwd == "/" or hide_root_folder then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -16,7 +16,9 @@ end
|
||||
local running = {}
|
||||
|
||||
function M.fn(fname)
|
||||
if running[fname] or not TreeExplorer then return end
|
||||
if running[fname] or not TreeExplorer then
|
||||
return
|
||||
end
|
||||
running[fname] = true
|
||||
|
||||
local i = get_index_offset()
|
||||
@@ -29,7 +31,7 @@ function M.fn(fname)
|
||||
return i
|
||||
end
|
||||
|
||||
local path_matches = node.nodes and vim.startswith(fname, node.absolute_path..utils.path_separator)
|
||||
local path_matches = node.nodes and vim.startswith(fname, node.absolute_path .. utils.path_separator)
|
||||
if path_matches then
|
||||
if not node.open then
|
||||
node.open = true
|
||||
@@ -43,7 +45,7 @@ function M.fn(fname)
|
||||
if iterate_nodes(node.nodes) ~= nil then
|
||||
return i
|
||||
end
|
||||
-- mandatory to iterate i
|
||||
-- mandatory to iterate i
|
||||
elseif node.open then
|
||||
iterate_nodes(node.nodes)
|
||||
end
|
||||
@@ -55,7 +57,7 @@ function M.fn(fname)
|
||||
renderer.draw()
|
||||
end
|
||||
if index and view.is_visible() then
|
||||
view.set_cursor({index, 0})
|
||||
view.set_cursor { index, 0 }
|
||||
end
|
||||
running[fname] = false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user