fix: remaining type errors
This commit is contained in:
parent
ebf9337b32
commit
8f7807946a
7 changed files with 64 additions and 44 deletions
|
|
@ -6,13 +6,14 @@ local fs = require("oil.fs")
|
||||||
local permissions = require("oil.adapters.files.permissions")
|
local permissions = require("oil.adapters.files.permissions")
|
||||||
local trash = require("oil.adapters.files.trash")
|
local trash = require("oil.adapters.files.trash")
|
||||||
local util = require("oil.util")
|
local util = require("oil.util")
|
||||||
|
local uv = vim.uv or vim.loop
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local FIELD_NAME = constants.FIELD_NAME
|
local FIELD_NAME = constants.FIELD_NAME
|
||||||
local FIELD_META = constants.FIELD_META
|
local FIELD_META = constants.FIELD_META
|
||||||
|
|
||||||
local function read_link_data(path, cb)
|
local function read_link_data(path, cb)
|
||||||
vim.loop.fs_readlink(
|
uv.fs_readlink(
|
||||||
path,
|
path,
|
||||||
vim.schedule_wrap(function(link_err, link)
|
vim.schedule_wrap(function(link_err, link)
|
||||||
if link_err then
|
if link_err then
|
||||||
|
|
@ -22,7 +23,7 @@ local function read_link_data(path, cb)
|
||||||
if not fs.is_absolute(link) then
|
if not fs.is_absolute(link) then
|
||||||
stat_path = fs.join(vim.fn.fnamemodify(path, ":h"), link)
|
stat_path = fs.join(vim.fn.fnamemodify(path, ":h"), link)
|
||||||
end
|
end
|
||||||
vim.loop.fs_stat(stat_path, function(stat_err, stat)
|
uv.fs_stat(stat_path, function(stat_err, stat)
|
||||||
cb(nil, link, stat)
|
cb(nil, link, stat)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -48,7 +49,7 @@ local fs_stat_meta_fields = {
|
||||||
local _, path = util.parse_url(parent_url)
|
local _, path = util.parse_url(parent_url)
|
||||||
assert(path)
|
assert(path)
|
||||||
local dir = fs.posix_to_os_path(path)
|
local dir = fs.posix_to_os_path(path)
|
||||||
vim.loop.fs_stat(fs.join(dir, entry[FIELD_NAME]), cb)
|
uv.fs_stat(fs.join(dir, entry[FIELD_NAME]), cb)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +122,7 @@ if not fs.is_windows then
|
||||||
local _, path = util.parse_url(action.url)
|
local _, path = util.parse_url(action.url)
|
||||||
assert(path)
|
assert(path)
|
||||||
path = fs.posix_to_os_path(path)
|
path = fs.posix_to_os_path(path)
|
||||||
vim.loop.fs_stat(path, function(err, stat)
|
uv.fs_stat(path, function(err, stat)
|
||||||
if err then
|
if err then
|
||||||
return callback(err)
|
return callback(err)
|
||||||
end
|
end
|
||||||
|
|
@ -129,7 +130,7 @@ if not fs.is_windows then
|
||||||
-- We are only changing the lower 12 bits of the mode
|
-- We are only changing the lower 12 bits of the mode
|
||||||
local mask = bit.bnot(bit.lshift(1, 12) - 1)
|
local mask = bit.bnot(bit.lshift(1, 12) - 1)
|
||||||
local old_mode = bit.band(stat.mode, mask)
|
local old_mode = bit.band(stat.mode, mask)
|
||||||
vim.loop.fs_chmod(path, bit.bor(old_mode, action.value), callback)
|
uv.fs_chmod(path, bit.bor(old_mode, action.value), callback)
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
@ -184,9 +185,9 @@ M.normalize_url = function(url, callback)
|
||||||
local scheme, path = util.parse_url(url)
|
local scheme, path = util.parse_url(url)
|
||||||
assert(path)
|
assert(path)
|
||||||
local os_path = vim.fn.fnamemodify(fs.posix_to_os_path(path), ":p")
|
local os_path = vim.fn.fnamemodify(fs.posix_to_os_path(path), ":p")
|
||||||
vim.loop.fs_realpath(os_path, function(err, new_os_path)
|
uv.fs_realpath(os_path, function(err, new_os_path)
|
||||||
local realpath = new_os_path or os_path
|
local realpath = new_os_path or os_path
|
||||||
vim.loop.fs_stat(
|
uv.fs_stat(
|
||||||
realpath,
|
realpath,
|
||||||
vim.schedule_wrap(function(stat_err, stat)
|
vim.schedule_wrap(function(stat_err, stat)
|
||||||
local is_directory
|
local is_directory
|
||||||
|
|
@ -225,7 +226,8 @@ M.list = function(url, column_defs, callback)
|
||||||
end
|
end
|
||||||
callback(err, data)
|
callback(err, data)
|
||||||
end
|
end
|
||||||
vim.loop.fs_opendir(dir, function(open_err, fd)
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
uv.fs_opendir(dir, function(open_err, fd)
|
||||||
if open_err then
|
if open_err then
|
||||||
if open_err:match("^ENOENT: no such file or directory") then
|
if open_err:match("^ENOENT: no such file or directory") then
|
||||||
-- If the directory doesn't exist, treat the list as a success. We will be able to traverse
|
-- If the directory doesn't exist, treat the list as a success. We will be able to traverse
|
||||||
|
|
@ -241,9 +243,9 @@ M.list = function(url, column_defs, callback)
|
||||||
cb(read_err)
|
cb(read_err)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.loop.fs_readdir(fd, function(err, entries)
|
uv.fs_readdir(fd, function(err, entries)
|
||||||
if err then
|
if err then
|
||||||
vim.loop.fs_closedir(fd, function()
|
uv.fs_closedir(fd, function()
|
||||||
cb(err)
|
cb(err)
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
|
|
@ -287,7 +289,7 @@ M.list = function(url, column_defs, callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
vim.loop.fs_closedir(fd, function(close_err)
|
uv.fs_closedir(fd, function(close_err)
|
||||||
if close_err then
|
if close_err then
|
||||||
cb(close_err)
|
cb(close_err)
|
||||||
else
|
else
|
||||||
|
|
@ -298,6 +300,7 @@ M.list = function(url, column_defs, callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
read_next()
|
read_next()
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
end, 100) -- TODO do some testing for this
|
end, 100) -- TODO do some testing for this
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -308,7 +311,7 @@ M.is_modifiable = function(bufnr)
|
||||||
local _, path = util.parse_url(bufname)
|
local _, path = util.parse_url(bufname)
|
||||||
assert(path)
|
assert(path)
|
||||||
local dir = fs.posix_to_os_path(path)
|
local dir = fs.posix_to_os_path(path)
|
||||||
local stat = vim.loop.fs_stat(dir)
|
local stat = uv.fs_stat(dir)
|
||||||
if not stat then
|
if not stat then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
@ -318,8 +321,8 @@ M.is_modifiable = function(bufnr)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local uid = vim.loop.getuid()
|
local uid = uv.getuid()
|
||||||
local gid = vim.loop.getgid()
|
local gid = uv.getgid()
|
||||||
local rwx
|
local rwx
|
||||||
if uid == stat.uid then
|
if uid == stat.uid then
|
||||||
rwx = bit.rshift(stat.mode, 6)
|
rwx = bit.rshift(stat.mode, 6)
|
||||||
|
|
@ -376,7 +379,7 @@ M.perform_action = function(action, cb)
|
||||||
assert(path)
|
assert(path)
|
||||||
path = fs.posix_to_os_path(path)
|
path = fs.posix_to_os_path(path)
|
||||||
if action.entry_type == "directory" then
|
if action.entry_type == "directory" then
|
||||||
vim.loop.fs_mkdir(path, 493, function(err)
|
uv.fs_mkdir(path, 493, function(err)
|
||||||
-- Ignore if the directory already exists
|
-- Ignore if the directory already exists
|
||||||
if not err or err:match("^EEXIST:") then
|
if not err or err:match("^EEXIST:") then
|
||||||
cb()
|
cb()
|
||||||
|
|
@ -393,7 +396,7 @@ M.perform_action = function(action, cb)
|
||||||
junction = false,
|
junction = false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
vim.loop.fs_symlink(target, path, flags, cb)
|
uv.fs_symlink(target, path, flags, cb)
|
||||||
else
|
else
|
||||||
fs.touch(path, cb)
|
fs.touch(path, cb)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ function SSHConnection.new(url)
|
||||||
util.run_in_fullscreen_win(term_bufnr, function()
|
util.run_in_fullscreen_win(term_bufnr, function()
|
||||||
term_id = vim.api.nvim_open_term(term_bufnr, {
|
term_id = vim.api.nvim_open_term(term_bufnr, {
|
||||||
on_input = function(_, _, _, data)
|
on_input = function(_, _, _, data)
|
||||||
|
---@diagnostic disable-next-line: invisible
|
||||||
pcall(vim.api.nvim_chan_send, self.jid, data)
|
pcall(vim.api.nvim_chan_send, self.jid, data)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@type boolean
|
local uv = vim.uv or vim.loop
|
||||||
M.is_windows = vim.loop.os_uname().version:match("Windows")
|
|
||||||
|
|
||||||
M.is_mac = vim.loop.os_uname().sysname == "Darwin"
|
---@type boolean
|
||||||
|
M.is_windows = uv.os_uname().version:match("Windows")
|
||||||
|
|
||||||
|
M.is_mac = uv.os_uname().sysname == "Darwin"
|
||||||
|
|
||||||
---@type string
|
---@type string
|
||||||
M.sep = M.is_windows and "\\" or "/"
|
M.sep = M.is_windows and "\\" or "/"
|
||||||
|
|
@ -27,12 +29,12 @@ end
|
||||||
---@param path string
|
---@param path string
|
||||||
---@param cb fun(err: nil|string)
|
---@param cb fun(err: nil|string)
|
||||||
M.touch = function(path, cb)
|
M.touch = function(path, cb)
|
||||||
vim.loop.fs_open(path, "a", 420, function(err, fd) -- 0644
|
uv.fs_open(path, "a", 420, function(err, fd) -- 0644
|
||||||
if err then
|
if err then
|
||||||
cb(err)
|
cb(err)
|
||||||
else
|
else
|
||||||
assert(fd)
|
assert(fd)
|
||||||
vim.loop.fs_close(fd, cb)
|
uv.fs_close(fd, cb)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -69,7 +71,7 @@ M.os_to_posix_path = function(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local home_dir = assert(vim.loop.os_homedir())
|
local home_dir = assert(uv.os_homedir())
|
||||||
|
|
||||||
---@param path string
|
---@param path string
|
||||||
---@return string
|
---@return string
|
||||||
|
|
@ -98,30 +100,32 @@ M.mkdirp = function(dir)
|
||||||
while mod ~= "" do
|
while mod ~= "" do
|
||||||
mod = mod:sub(3)
|
mod = mod:sub(3)
|
||||||
path = vim.fn.fnamemodify(dir, mod)
|
path = vim.fn.fnamemodify(dir, mod)
|
||||||
vim.loop.fs_mkdir(path, 493)
|
uv.fs_mkdir(path, 493)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param dir string
|
---@param dir string
|
||||||
---@param cb fun(err: nil|string, entries: nil|{type: oil.EntryType, name: string})
|
---@param cb fun(err: nil|string, entries: nil|{type: oil.EntryType, name: string})
|
||||||
M.listdir = function(dir, cb)
|
M.listdir = function(dir, cb)
|
||||||
vim.loop.fs_opendir(dir, function(open_err, fd)
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
uv.fs_opendir(dir, function(open_err, fd)
|
||||||
if open_err then
|
if open_err then
|
||||||
return cb(open_err)
|
return cb(open_err)
|
||||||
end
|
end
|
||||||
local read_next
|
local read_next
|
||||||
read_next = function()
|
read_next = function()
|
||||||
vim.loop.fs_readdir(fd, function(err, entries)
|
uv.fs_readdir(fd, function(err, entries)
|
||||||
if err then
|
if err then
|
||||||
vim.loop.fs_closedir(fd, function()
|
uv.fs_closedir(fd, function()
|
||||||
cb(err)
|
cb(err)
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
elseif entries then
|
elseif entries then
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
cb(nil, entries)
|
cb(nil, entries)
|
||||||
read_next()
|
read_next()
|
||||||
else
|
else
|
||||||
vim.loop.fs_closedir(fd, function(close_err)
|
uv.fs_closedir(fd, function(close_err)
|
||||||
if close_err then
|
if close_err then
|
||||||
cb(close_err)
|
cb(close_err)
|
||||||
else
|
else
|
||||||
|
|
@ -132,6 +136,7 @@ M.listdir = function(dir, cb)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
read_next()
|
read_next()
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
end, 100) -- TODO do some testing for this
|
end, 100) -- TODO do some testing for this
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -140,15 +145,16 @@ end
|
||||||
---@param cb fun(err: nil|string)
|
---@param cb fun(err: nil|string)
|
||||||
M.recursive_delete = function(entry_type, path, cb)
|
M.recursive_delete = function(entry_type, path, cb)
|
||||||
if entry_type ~= "directory" then
|
if entry_type ~= "directory" then
|
||||||
return vim.loop.fs_unlink(path, cb)
|
return uv.fs_unlink(path, cb)
|
||||||
end
|
end
|
||||||
vim.loop.fs_opendir(path, function(open_err, fd)
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
uv.fs_opendir(path, function(open_err, fd)
|
||||||
if open_err then
|
if open_err then
|
||||||
return cb(open_err)
|
return cb(open_err)
|
||||||
end
|
end
|
||||||
local poll
|
local poll
|
||||||
poll = function(inner_cb)
|
poll = function(inner_cb)
|
||||||
vim.loop.fs_readdir(fd, function(err, entries)
|
uv.fs_readdir(fd, function(err, entries)
|
||||||
if err then
|
if err then
|
||||||
return inner_cb(err)
|
return inner_cb(err)
|
||||||
elseif entries then
|
elseif entries then
|
||||||
|
|
@ -173,12 +179,13 @@ M.recursive_delete = function(entry_type, path, cb)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
poll(function(err)
|
poll(function(err)
|
||||||
vim.loop.fs_closedir(fd)
|
uv.fs_closedir(fd)
|
||||||
if err then
|
if err then
|
||||||
return cb(err)
|
return cb(err)
|
||||||
end
|
end
|
||||||
vim.loop.fs_rmdir(path, cb)
|
uv.fs_rmdir(path, cb)
|
||||||
end)
|
end)
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
end, 100) -- TODO do some testing for this
|
end, 100) -- TODO do some testing for this
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -188,35 +195,36 @@ end
|
||||||
---@param cb fun(err: nil|string)
|
---@param cb fun(err: nil|string)
|
||||||
M.recursive_copy = function(entry_type, src_path, dest_path, cb)
|
M.recursive_copy = function(entry_type, src_path, dest_path, cb)
|
||||||
if entry_type == "link" then
|
if entry_type == "link" then
|
||||||
vim.loop.fs_readlink(src_path, function(link_err, link)
|
uv.fs_readlink(src_path, function(link_err, link)
|
||||||
if link_err then
|
if link_err then
|
||||||
return cb(link_err)
|
return cb(link_err)
|
||||||
end
|
end
|
||||||
assert(link)
|
assert(link)
|
||||||
vim.loop.fs_symlink(link, dest_path, 0, cb)
|
uv.fs_symlink(link, dest_path, 0, cb)
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if entry_type ~= "directory" then
|
if entry_type ~= "directory" then
|
||||||
vim.loop.fs_copyfile(src_path, dest_path, { excl = true }, cb)
|
uv.fs_copyfile(src_path, dest_path, { excl = true }, cb)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.loop.fs_stat(src_path, function(stat_err, src_stat)
|
uv.fs_stat(src_path, function(stat_err, src_stat)
|
||||||
if stat_err then
|
if stat_err then
|
||||||
return cb(stat_err)
|
return cb(stat_err)
|
||||||
end
|
end
|
||||||
assert(src_stat)
|
assert(src_stat)
|
||||||
vim.loop.fs_mkdir(dest_path, src_stat.mode, function(mkdir_err)
|
uv.fs_mkdir(dest_path, src_stat.mode, function(mkdir_err)
|
||||||
if mkdir_err then
|
if mkdir_err then
|
||||||
return cb(mkdir_err)
|
return cb(mkdir_err)
|
||||||
end
|
end
|
||||||
vim.loop.fs_opendir(src_path, function(open_err, fd)
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
uv.fs_opendir(src_path, function(open_err, fd)
|
||||||
if open_err then
|
if open_err then
|
||||||
return cb(open_err)
|
return cb(open_err)
|
||||||
end
|
end
|
||||||
local poll
|
local poll
|
||||||
poll = function(inner_cb)
|
poll = function(inner_cb)
|
||||||
vim.loop.fs_readdir(fd, function(err, entries)
|
uv.fs_readdir(fd, function(err, entries)
|
||||||
if err then
|
if err then
|
||||||
return inner_cb(err)
|
return inner_cb(err)
|
||||||
elseif entries then
|
elseif entries then
|
||||||
|
|
@ -246,6 +254,7 @@ M.recursive_copy = function(entry_type, src_path, dest_path, cb)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
poll(cb)
|
poll(cb)
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
end, 100) -- TODO do some testing for this
|
end, 100) -- TODO do some testing for this
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
@ -256,7 +265,7 @@ end
|
||||||
---@param dest_path string
|
---@param dest_path string
|
||||||
---@param cb fun(err: nil|string)
|
---@param cb fun(err: nil|string)
|
||||||
M.recursive_move = function(entry_type, src_path, dest_path, cb)
|
M.recursive_move = function(entry_type, src_path, dest_path, cb)
|
||||||
vim.loop.fs_rename(src_path, dest_path, function(err)
|
uv.fs_rename(src_path, dest_path, function(err)
|
||||||
if err then
|
if err then
|
||||||
-- fs_rename fails for cross-partition or cross-device operations.
|
-- fs_rename fails for cross-partition or cross-device operations.
|
||||||
-- We then fall back to a copy + delete
|
-- We then fall back to a copy + delete
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ local M = {}
|
||||||
---@field id nil|integer Will be nil if it hasn't been persisted to disk yet
|
---@field id nil|integer Will be nil if it hasn't been persisted to disk yet
|
||||||
---@field parsed_name nil|string
|
---@field parsed_name nil|string
|
||||||
|
|
||||||
---@alias oil.EntryType "file"|"directory"|"socket"|"link"
|
---@alias oil.EntryType "file"|"directory"|"socket"|"link"|"fifo"
|
||||||
---@alias oil.TextChunk string|string[]
|
---@alias oil.TextChunk string|string[]
|
||||||
|
|
||||||
---@class oil.Adapter
|
---@class oil.Adapter
|
||||||
|
|
@ -22,6 +22,9 @@ local M = {}
|
||||||
---@field read_file fun(bufnr: integer)
|
---@field read_file fun(bufnr: integer)
|
||||||
---@field write_file fun(bufnr: integer)
|
---@field write_file fun(bufnr: integer)
|
||||||
|
|
||||||
|
-- TODO remove after https://github.com/folke/neodev.nvim/pull/163 lands
|
||||||
|
---@diagnostic disable: undefined-field
|
||||||
|
|
||||||
---Get the entry on a specific line (1-indexed)
|
---Get the entry on a specific line (1-indexed)
|
||||||
---@param bufnr integer
|
---@param bufnr integer
|
||||||
---@param lnum integer
|
---@param lnum integer
|
||||||
|
|
@ -214,7 +217,8 @@ M.get_buffer_parent_url = function(bufname)
|
||||||
assert(path)
|
assert(path)
|
||||||
-- TODO maybe we should remove this special case and turn it into a config
|
-- TODO maybe we should remove this special case and turn it into a config
|
||||||
if scheme == "term://" then
|
if scheme == "term://" then
|
||||||
path = vim.fn.expand(path:match("^(.*)//"))
|
---@type string
|
||||||
|
path = vim.fn.expand(path:match("^(.*)//")) ---@diagnostic disable-line: assign-type-mismatch
|
||||||
return config.adapter_to_scheme.files .. util.addslash(path)
|
return config.adapter_to_scheme.files .. util.addslash(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -903,6 +907,7 @@ M.setup = function(opts)
|
||||||
if not util.is_oil_bufnr(0) then
|
if not util.is_oil_bufnr(0) then
|
||||||
vim.w.oil_original_buffer = vim.api.nvim_get_current_buf()
|
vim.w.oil_original_buffer = vim.api.nvim_get_current_buf()
|
||||||
vim.w.oil_original_view = vim.fn.winsaveview()
|
vim.w.oil_original_view = vim.fn.winsaveview()
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
vim.w.oil_original_alternate = vim.fn.bufnr("#")
|
vim.w.oil_original_alternate = vim.fn.bufnr("#")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,7 @@ M.try_write_changes = function(confirm)
|
||||||
{ all_errors[curbuf][1].lnum + 1, all_errors[curbuf][1].col }
|
{ all_errors[curbuf][1].lnum + 1, all_errors[curbuf][1].col }
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
local bufnr, errs = next(pairs(all_errors))
|
local bufnr, errs = next(pairs(all_errors))
|
||||||
vim.api.nvim_win_set_buf(0, bufnr)
|
vim.api.nvim_win_set_buf(0, bufnr)
|
||||||
pcall(vim.api.nvim_win_set_cursor, 0, { errs[1].lnum + 1, errs[1].col })
|
pcall(vim.api.nvim_win_set_cursor, 0, { errs[1].lnum + 1, errs[1].col })
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ end
|
||||||
---Add all actions affecting children of the url
|
---Add all actions affecting children of the url
|
||||||
---@param url string
|
---@param url string
|
||||||
---@param ret oil.InternalEntry[]
|
---@param ret oil.InternalEntry[]
|
||||||
---@param filter nil|fun(entry: oil.InternalEntry): boolean
|
---@param filter nil|fun(entry: oil.Action): boolean
|
||||||
function Trie:accum_children_of(url, ret, filter)
|
function Trie:accum_children_of(url, ret, filter)
|
||||||
local pieces = self:_url_to_path_pieces(url)
|
local pieces = self:_url_to_path_pieces(url)
|
||||||
local current = self.root
|
local current = self.root
|
||||||
|
|
@ -136,7 +136,7 @@ end
|
||||||
---Add all actions at a specific path
|
---Add all actions at a specific path
|
||||||
---@param url string
|
---@param url string
|
||||||
---@param ret oil.InternalEntry[]
|
---@param ret oil.InternalEntry[]
|
||||||
---@param filter? fun(entry: oil.InternalEntry): boolean
|
---@param filter? fun(entry: oil.Action): boolean
|
||||||
function Trie:accum_actions_at(url, ret, filter)
|
function Trie:accum_actions_at(url, ret, filter)
|
||||||
local pieces = self:_url_to_path_pieces(url)
|
local pieces = self:_url_to_path_pieces(url)
|
||||||
local current = self.root
|
local current = self.root
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,7 @@ M.rename_buffer = function(src_bufnr, dest_buf_name)
|
||||||
-- rename logic. The only reason we can't use nvim_buf_set_name on files is because vim will
|
-- rename logic. The only reason we can't use nvim_buf_set_name on files is because vim will
|
||||||
-- think that the new buffer conflicts with the file next time it tries to save.
|
-- think that the new buffer conflicts with the file next time it tries to save.
|
||||||
if not vim.loop.fs_stat(dest_buf_name) then
|
if not vim.loop.fs_stat(dest_buf_name) then
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
local altbuf = vim.fn.bufnr("#")
|
local altbuf = vim.fn.bufnr("#")
|
||||||
-- This will fail if the dest buf name already exists
|
-- This will fail if the dest buf name already exists
|
||||||
local ok = pcall(vim.api.nvim_buf_set_name, src_bufnr, dest_buf_name)
|
local ok = pcall(vim.api.nvim_buf_set_name, src_bufnr, dest_buf_name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue