ci: typechecking no longer requires neodev
This commit is contained in:
parent
8ac4ba4e0a
commit
15e071f203
8 changed files with 31 additions and 31 deletions
|
|
@ -1,9 +1,6 @@
|
|||
local oil = require("oil")
|
||||
local util = require("oil.util")
|
||||
|
||||
-- TODO remove after https://github.com/folke/neodev.nvim/pull/163 lands
|
||||
---@diagnostic disable: inject-field
|
||||
|
||||
local M = {}
|
||||
|
||||
M.show_help = {
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ end
|
|||
---@return nil|oil.InternalEntry
|
||||
M.get_entry_by_url = function(url)
|
||||
local scheme, path = util.parse_url(url)
|
||||
assert(path)
|
||||
local parent_url = scheme .. vim.fn.fnamemodify(path, ":h")
|
||||
local basename = vim.fn.fnamemodify(path, ":t")
|
||||
return M.list_url(parent_url)[basename]
|
||||
|
|
@ -150,11 +151,13 @@ end
|
|||
M.perform_action = function(action)
|
||||
if action.type == "create" then
|
||||
local scheme, path = util.parse_url(action.url)
|
||||
assert(path)
|
||||
local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h"))
|
||||
local name = vim.fn.fnamemodify(path, ":t")
|
||||
M.create_and_store_entry(parent_url, name, action.entry_type)
|
||||
elseif action.type == "delete" then
|
||||
local scheme, path = util.parse_url(action.url)
|
||||
assert(path)
|
||||
local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h"))
|
||||
local name = vim.fn.fnamemodify(path, ":t")
|
||||
local entry = url_directory[parent_url][name]
|
||||
|
|
@ -163,11 +166,13 @@ M.perform_action = function(action)
|
|||
parent_url_by_id[entry[FIELD_ID]] = nil
|
||||
elseif action.type == "move" then
|
||||
local src_scheme, src_path = util.parse_url(action.src_url)
|
||||
assert(src_path)
|
||||
local src_parent_url = util.addslash(src_scheme .. vim.fn.fnamemodify(src_path, ":h"))
|
||||
local src_name = vim.fn.fnamemodify(src_path, ":t")
|
||||
local entry = url_directory[src_parent_url][src_name]
|
||||
|
||||
local dest_scheme, dest_path = util.parse_url(action.dest_url)
|
||||
assert(dest_path)
|
||||
local dest_parent_url = util.addslash(dest_scheme .. vim.fn.fnamemodify(dest_path, ":h"))
|
||||
local dest_name = vim.fn.fnamemodify(dest_path, ":t")
|
||||
|
||||
|
|
@ -185,6 +190,7 @@ M.perform_action = function(action)
|
|||
util.update_moved_buffers(action.entry_type, action.src_url, action.dest_url)
|
||||
elseif action.type == "copy" then
|
||||
local scheme, path = util.parse_url(action.dest_url)
|
||||
assert(path)
|
||||
local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h"))
|
||||
local name = vim.fn.fnamemodify(path, ":t")
|
||||
M.create_and_store_entry(parent_url, name, action.entry_type)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ local M = {}
|
|||
---@field list fun(path: string, column_defs: string[], cb: fun(err?: string, entries?: oil.InternalEntry[], fetch_more?: fun())) Async function to list a directory.
|
||||
---@field is_modifiable fun(bufnr: integer): boolean Return true if this directory is modifiable (allows for directories with read-only permissions).
|
||||
---@field get_column fun(name: string): nil|oil.ColumnDefinition If the adapter has any adapter-specific columns, return them when fetched by name.
|
||||
---@field get_parent? fun(bufname: string): string Get the parent url of the given buffer
|
||||
---@field normalize_url fun(url: string, callback: fun(url: string)) Before oil opens a url it will be normalized. This allows for link following, path normalizing, and converting an oil file url to the actual path of a file.
|
||||
---@field get_entry_path? fun(url: string, entry: oil.Entry, callback: fun(path: string)) Similar to normalize_url, but used when selecting an entry
|
||||
---@field render_action? fun(action: oil.Action): string Render a mutation action for display in the preview window. Only needed if adapter is modifiable.
|
||||
|
|
@ -29,10 +30,6 @@ local M = {}
|
|||
---@field filter_action? fun(action: oil.Action): boolean When present, filter out actions as they are created
|
||||
---@field filter_error? fun(action: oil.ParseError): boolean When present, filter out errors from parsing a buffer
|
||||
|
||||
-- TODO remove after https://github.com/folke/neodev.nvim/pull/163 lands
|
||||
---@diagnostic disable: undefined-field
|
||||
---@diagnostic disable: inject-field
|
||||
|
||||
---Get the entry on a specific line (1-indexed)
|
||||
---@param bufnr integer
|
||||
---@param lnum integer
|
||||
|
|
@ -540,11 +537,11 @@ M.open_preview = function(opts, callback)
|
|||
end
|
||||
|
||||
---@class (exact) oil.SelectOpts
|
||||
---@field vertical boolean Open the buffer in a vertical split
|
||||
---@field horizontal boolean Open the buffer in a horizontal split
|
||||
---@field split "aboveleft"|"belowright"|"topleft"|"botright" Split modifier
|
||||
---@field tab boolean Open the buffer in a new tab
|
||||
---@field close boolean Close the original oil buffer once selection is made
|
||||
---@field vertical? boolean Open the buffer in a vertical split
|
||||
---@field horizontal? boolean Open the buffer in a horizontal split
|
||||
---@field split? "aboveleft"|"belowright"|"topleft"|"botright" Split modifier
|
||||
---@field tab? boolean Open the buffer in a new tab
|
||||
---@field close? boolean Close the original oil buffer once selection is made
|
||||
|
||||
---Select the entry under the cursor
|
||||
---@param opts nil|oil.SelectOpts
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ M.show_help = function(keymaps)
|
|||
end
|
||||
vim.keymap.set("n", "q", "<cmd>close<CR>", { buffer = bufnr })
|
||||
vim.keymap.set("n", "<c-c>", "<cmd>close<CR>", { buffer = bufnr })
|
||||
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
|
||||
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe")
|
||||
vim.bo[bufnr].modifiable = false
|
||||
vim.bo[bufnr].bufhidden = "wipe"
|
||||
|
||||
local editor_width = vim.o.columns
|
||||
local editor_height = layout.get_editor_height()
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ M.initialize = function(bufnr)
|
|||
vim.b[bufnr].EditorConfig_disable = 1
|
||||
session[bufnr] = session[bufnr] or {}
|
||||
for k, v in pairs(config.buf_options) do
|
||||
vim.api.nvim_buf_set_option(bufnr, k, v)
|
||||
vim.bo[bufnr][k] = v
|
||||
end
|
||||
M.set_win_options()
|
||||
vim.api.nvim_create_autocmd("BufHidden", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue