ci: typechecking no longer requires neodev

This commit is contained in:
Steven Arcangeli 2024-06-01 16:13:36 -07:00
parent 8ac4ba4e0a
commit 15e071f203
8 changed files with 31 additions and 31 deletions

View file

@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: stevearc/nvim-typecheck-action@v1 - uses: stevearc/nvim-typecheck-action@v2
with: with:
path: lua path: lua

View file

@ -135,13 +135,13 @@ Preview the entry under the cursor in a split
Select the entry under the cursor Select the entry under the cursor
| Param | Type | Desc | | | Param | Type | Desc | |
| -------- | ---------------------------- | -------------------------------------------------- | ---------------------------------------------------- | | -------- | ---------------------------- | ------------------------------------------------------- | ---------------------------------------------------- |
| opts | `nil\|oil.SelectOpts` | | | | opts | `nil\|oil.SelectOpts` | | |
| | vertical | `boolean` | Open the buffer in a vertical split | | | vertical | `nil\|boolean` | Open the buffer in a vertical split |
| | horizontal | `boolean` | Open the buffer in a horizontal split | | | horizontal | `nil\|boolean` | Open the buffer in a horizontal split |
| | split | `"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier | | | split | `nil\|"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| | tab | `boolean` | Open the buffer in a new tab | | | tab | `nil\|boolean` | Open the buffer in a new tab |
| | close | `boolean` | Close the original oil buffer once selection is made | | | close | `nil\|boolean` | Close the original oil buffer once selection is made |
| callback | `nil\|fun(err: nil\|string)` | Called once all entries have been opened | | | callback | `nil\|fun(err: nil\|string)` | Called once all entries have been opened | |
## save(opts, cb) ## save(opts, cb)

View file

@ -312,13 +312,13 @@ select({opts}, {callback}) *oil.selec
Parameters: Parameters:
{opts} `nil|oil.SelectOpts` {opts} `nil|oil.SelectOpts`
{vertical} `boolean` Open the buffer in a vertical split {vertical} `nil|boolean` Open the buffer in a vertical split
{horizontal} `boolean` Open the buffer in a horizontal split {horizontal} `nil|boolean` Open the buffer in a horizontal split
{split} `"aboveleft"|"belowright"|"topleft"|"botright"` Split {split} `nil|"aboveleft"|"belowright"|"topleft"|"botright"` Split
modifier modifier
{tab} `boolean` Open the buffer in a new tab {tab} `nil|boolean` Open the buffer in a new tab
{close} `boolean` Close the original oil buffer once selection is {close} `nil|boolean` Close the original oil buffer once
made selection is made
{callback} `nil|fun(err: nil|string)` Called once all entries have been {callback} `nil|fun(err: nil|string)` Called once all entries have been
opened opened

View file

@ -1,9 +1,6 @@
local oil = require("oil") local oil = require("oil")
local util = require("oil.util") local util = require("oil.util")
-- TODO remove after https://github.com/folke/neodev.nvim/pull/163 lands
---@diagnostic disable: inject-field
local M = {} local M = {}
M.show_help = { M.show_help = {

View file

@ -124,6 +124,7 @@ end
---@return nil|oil.InternalEntry ---@return nil|oil.InternalEntry
M.get_entry_by_url = function(url) M.get_entry_by_url = function(url)
local scheme, path = util.parse_url(url) local scheme, path = util.parse_url(url)
assert(path)
local parent_url = scheme .. vim.fn.fnamemodify(path, ":h") local parent_url = scheme .. vim.fn.fnamemodify(path, ":h")
local basename = vim.fn.fnamemodify(path, ":t") local basename = vim.fn.fnamemodify(path, ":t")
return M.list_url(parent_url)[basename] return M.list_url(parent_url)[basename]
@ -150,11 +151,13 @@ end
M.perform_action = function(action) M.perform_action = function(action)
if action.type == "create" then if action.type == "create" then
local scheme, path = util.parse_url(action.url) local scheme, path = util.parse_url(action.url)
assert(path)
local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h")) local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h"))
local name = vim.fn.fnamemodify(path, ":t") local name = vim.fn.fnamemodify(path, ":t")
M.create_and_store_entry(parent_url, name, action.entry_type) M.create_and_store_entry(parent_url, name, action.entry_type)
elseif action.type == "delete" then elseif action.type == "delete" then
local scheme, path = util.parse_url(action.url) local scheme, path = util.parse_url(action.url)
assert(path)
local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h")) local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h"))
local name = vim.fn.fnamemodify(path, ":t") local name = vim.fn.fnamemodify(path, ":t")
local entry = url_directory[parent_url][name] local entry = url_directory[parent_url][name]
@ -163,11 +166,13 @@ M.perform_action = function(action)
parent_url_by_id[entry[FIELD_ID]] = nil parent_url_by_id[entry[FIELD_ID]] = nil
elseif action.type == "move" then elseif action.type == "move" then
local src_scheme, src_path = util.parse_url(action.src_url) 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_parent_url = util.addslash(src_scheme .. vim.fn.fnamemodify(src_path, ":h"))
local src_name = vim.fn.fnamemodify(src_path, ":t") local src_name = vim.fn.fnamemodify(src_path, ":t")
local entry = url_directory[src_parent_url][src_name] local entry = url_directory[src_parent_url][src_name]
local dest_scheme, dest_path = util.parse_url(action.dest_url) 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_parent_url = util.addslash(dest_scheme .. vim.fn.fnamemodify(dest_path, ":h"))
local dest_name = vim.fn.fnamemodify(dest_path, ":t") 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) util.update_moved_buffers(action.entry_type, action.src_url, action.dest_url)
elseif action.type == "copy" then elseif action.type == "copy" then
local scheme, path = util.parse_url(action.dest_url) local scheme, path = util.parse_url(action.dest_url)
assert(path)
local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h")) local parent_url = util.addslash(scheme .. vim.fn.fnamemodify(path, ":h"))
local name = vim.fn.fnamemodify(path, ":t") local name = vim.fn.fnamemodify(path, ":t")
M.create_and_store_entry(parent_url, name, action.entry_type) M.create_and_store_entry(parent_url, name, action.entry_type)

View file

@ -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 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 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_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 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 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. ---@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_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 ---@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) ---Get the entry on a specific line (1-indexed)
---@param bufnr integer ---@param bufnr integer
---@param lnum integer ---@param lnum integer
@ -540,11 +537,11 @@ M.open_preview = function(opts, callback)
end end
---@class (exact) oil.SelectOpts ---@class (exact) oil.SelectOpts
---@field vertical boolean Open the buffer in a vertical split ---@field vertical? boolean Open the buffer in a vertical split
---@field horizontal boolean Open the buffer in a horizontal split ---@field horizontal? boolean Open the buffer in a horizontal split
---@field split "aboveleft"|"belowright"|"topleft"|"botright" Split modifier ---@field split? "aboveleft"|"belowright"|"topleft"|"botright" Split modifier
---@field tab boolean Open the buffer in a new tab ---@field tab? boolean Open the buffer in a new tab
---@field close boolean Close the original oil buffer once selection is made ---@field close? boolean Close the original oil buffer once selection is made
---Select the entry under the cursor ---Select the entry under the cursor
---@param opts nil|oil.SelectOpts ---@param opts nil|oil.SelectOpts

View file

@ -99,8 +99,8 @@ M.show_help = function(keymaps)
end end
vim.keymap.set("n", "q", "<cmd>close<CR>", { buffer = bufnr }) vim.keymap.set("n", "q", "<cmd>close<CR>", { buffer = bufnr })
vim.keymap.set("n", "<c-c>", "<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.bo[bufnr].modifiable = false
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe") vim.bo[bufnr].bufhidden = "wipe"
local editor_width = vim.o.columns local editor_width = vim.o.columns
local editor_height = layout.get_editor_height() local editor_height = layout.get_editor_height()

View file

@ -331,7 +331,7 @@ M.initialize = function(bufnr)
vim.b[bufnr].EditorConfig_disable = 1 vim.b[bufnr].EditorConfig_disable = 1
session[bufnr] = session[bufnr] or {} session[bufnr] = session[bufnr] or {}
for k, v in pairs(config.buf_options) do for k, v in pairs(config.buf_options) do
vim.api.nvim_buf_set_option(bufnr, k, v) vim.bo[bufnr][k] = v
end end
M.set_win_options() M.set_win_options()
vim.api.nvim_create_autocmd("BufHidden", { vim.api.nvim_create_autocmd("BufHidden", {