types: update type annotations for LuaLS 3.7

This commit is contained in:
Steven Arcangeli 2023-08-24 09:15:06 -07:00
parent b61bc9b701
commit e45aeebc2b
9 changed files with 34 additions and 16 deletions

View file

@ -385,6 +385,7 @@ M.perform_action = function(action, cb)
junction = false,
}
end
---@diagnostic disable-next-line: param-type-mismatch
uv.fs_symlink(target, path, flags, cb)
else
fs.touch(path, cb)

View file

@ -12,7 +12,7 @@ local M = {}
local FIELD_META = constants.FIELD_META
---@class oil.sshUrl
---@class (exact) oil.sshUrl
---@field scheme string
---@field host string
---@field user nil|string

View file

@ -1,10 +1,22 @@
local layout = require("oil.layout")
local util = require("oil.util")
---@class oil.sshConnection
---@class (exact) oil.sshCommand
---@field cmd string|string[]
---@field cb fun(err?: string, output?: string[])
---@field running? boolean
---@class (exact) oil.sshConnection
---@field new fun(url: oil.sshUrl): oil.sshConnection
---@field create_ssh_command fun(url: oil.sshUrl): string[]
---@field meta {user?: string, groups?: string[]}
---@field connection_error nil|string
---@field connected boolean
---@field private term_bufnr integer
---@field private jid integer
---@field private term_winid nil|integer
---@field private commands oil.sshCommand[]
---@field private _stdout string[]
local SSHConnection = {}
local function output_extend(agg, output)
@ -114,6 +126,7 @@ function SSHConnection.new(url)
pty = true, -- This is require for interactivity
on_stdout = function(j, output)
pcall(vim.api.nvim_chan_send, self.term_id, table.concat(output, "\r\n"))
---@diagnostic disable-next-line: invisible
local new_i_start = output_extend(self._stdout, output)
self:_handle_output(new_i_start)
end,

View file

@ -4,7 +4,8 @@ local permissions = require("oil.adapters.files.permissions")
local SSHConnection = require("oil.adapters.ssh.connection")
local util = require("oil.util")
---@class oil.sshFs
---@class (exact) oil.sshFs
---@field new fun(url: oil.sshUrl): oil.sshFs
---@field conn oil.sshConnection
local SSHFS = {}

View file

@ -12,7 +12,7 @@ local all_columns = {}
---@alias oil.ColumnSpec string|table
---@class oil.ColumnDefinition
---@class (exact) oil.ColumnDefinition
---@field render fun(entry: oil.InternalEntry, conf: nil|table): nil|oil.TextChunk
---@field parse fun(line: string, conf: nil|table): nil|string, nil|string
---@field meta_fields nil|table<string, fun(parent_url: string, entry: oil.InternalEntry, cb: fun(err: nil|string))>

View file

@ -1,6 +1,6 @@
local M = {}
---@class oil.Entry
---@class (exact) oil.Entry
---@field name string
---@field type oil.EntryType
---@field id nil|integer Will be nil if it hasn't been persisted to disk yet
@ -9,7 +9,7 @@ local M = {}
---@alias oil.EntryType "file"|"directory"|"socket"|"link"|"fifo"
---@alias oil.TextChunk string|string[]
---@class oil.Adapter
---@class (exact) oil.Adapter
---@field name string The unique name of the adapter (this will be set automatically)
---@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).
@ -23,6 +23,7 @@ local M = {}
-- 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

View file

@ -17,30 +17,30 @@ local FIELD_TYPE = constants.FIELD_TYPE
---@alias oil.Action oil.CreateAction|oil.DeleteAction|oil.MoveAction|oil.CopyAction|oil.ChangeAction
---@class oil.CreateAction
---@class (exact) oil.CreateAction
---@field type "create"
---@field url string
---@field entry_type oil.EntryType
---@field link nil|string
---@class oil.DeleteAction
---@class (exact) oil.DeleteAction
---@field type "delete"
---@field url string
---@field entry_type oil.EntryType
---@class oil.MoveAction
---@class (exact) oil.MoveAction
---@field type "move"
---@field entry_type oil.EntryType
---@field src_url string
---@field dest_url string
---@class oil.CopyAction
---@class (exact) oil.CopyAction
---@field type "copy"
---@field entry_type oil.EntryType
---@field src_url string
---@field dest_url string
---@class oil.ChangeAction
---@class (exact) oil.ChangeAction
---@field type "change"
---@field entry_type oil.EntryType
---@field url string
@ -71,6 +71,7 @@ M.create_actions_from_diffs = function(all_diffs)
if diff.id then
local by_id = diff_by_id[diff.id]
-- FIXME this is kind of a hack. We shouldn't be setting undocumented fields on the diff
---@diagnostic disable-next-line: inject-field
diff.dest = parent_url .. diff.name
table.insert(by_id, diff)
else

View file

@ -13,19 +13,19 @@ local FIELD_META = constants.FIELD_META
---@alias oil.Diff oil.DiffNew|oil.DiffDelete|oil.DiffChange
---@class oil.DiffNew
---@class (exact) oil.DiffNew
---@field type "new"
---@field name string
---@field entry_type oil.EntryType
---@field id nil|integer
---@field link nil|string
---@class oil.DiffDelete
---@class (exact) oil.DiffDelete
---@field type "delete"
---@field name string
---@field id integer
---
---@class oil.DiffChange
---@class (exact) oil.DiffChange
---@field type "change"
---@field entry_type oil.EntryType
---@field name string
@ -56,7 +56,7 @@ local function compare_link_target(meta, parsed_entry)
return meta_name == parsed_name
end
---@class oil.ParseResult
---@class (exact) oil.ParseResult
---@field data table Parsed entry data
---@field ranges table<string, integer[]> Locations of the various columns
---@field entry nil|oil.InternalEntry If the entry already exists

View file

@ -1,6 +1,7 @@
local util = require("oil.util")
---@class oil.Trie
---@class (exact) oil.Trie
---@field new fun(): oil.Trie
---@field private root table
local Trie = {}