chore: add stylua to format the codebase, and run on CI (#1055)
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
local utils = require"nvim-tree.utils"
|
||||
local view = require"nvim-tree.view"
|
||||
local renderer = require"nvim-tree.renderer"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local view = require "nvim-tree.view"
|
||||
local renderer = require "nvim-tree.renderer"
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.fn()
|
||||
if not TreeExplorer then return end
|
||||
if not TreeExplorer then
|
||||
return
|
||||
end
|
||||
|
||||
local input_path = vim.fn.input("Search node: ", "", "file")
|
||||
utils.clear_prompt()
|
||||
|
||||
local absolute_input_path = utils.path_join({
|
||||
local absolute_input_path = utils.path_join {
|
||||
TreeExplorer.cwd,
|
||||
input_path
|
||||
})
|
||||
input_path,
|
||||
}
|
||||
|
||||
local function count_visible_nodes(nodes)
|
||||
local visible_nodes = 0
|
||||
@@ -44,7 +46,7 @@ function M.fn()
|
||||
|
||||
if node.nodes then
|
||||
-- e.g. user searches for "/foo/bar.txt", than directory "/foo/bar" should not match with filename
|
||||
local matches = utils.str_find(absolute_input_path, node.absolute_path .. '/')
|
||||
local matches = utils.str_find(absolute_input_path, node.absolute_path .. "/")
|
||||
|
||||
if matches then
|
||||
found_something = true
|
||||
@@ -75,11 +77,11 @@ function M.fn()
|
||||
end
|
||||
|
||||
if found_something and view.is_visible() then
|
||||
if TreeExplorer.cwd ~= '/' and not view.View.hide_root_folder then
|
||||
if TreeExplorer.cwd ~= "/" and not view.View.hide_root_folder then
|
||||
index = index + 1
|
||||
end
|
||||
|
||||
view.set_cursor({index, 0})
|
||||
view.set_cursor { index, 0 }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user