Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
feat: add class to vim.api and vim.loop
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Feb 8, 2023
1 parent b3b22cf commit e27c03b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/neodev/build/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ function M.override(fname)
local override = Config.root("/types/override/" .. fname .. ".lua")
if override then
local code = Util.read_file(override)
local mod = dofile(override) or {}
local mod = {}
local mod_code = code:match("\n(return.*)") or code:match("^(return.*)")
if mod_code then
mod = load(mod_code)()
end
code = code:gsub("\nreturn.*", "")
code = code:gsub("^return.*", "")
return mod, code
Expand Down
2 changes: 2 additions & 0 deletions types/override/api.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---@class vim.api
vim.api = {}
3 changes: 3 additions & 0 deletions types/override/luv.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---@class vim.loop
vim.loop = {}

---@class vim.loop.Timer
---@field start fun(timer:vim.loop.Timer, timeout:integer, repeat:integer, callback:fun())
---@field stop fun(timer:vim.loop.Timer)
Expand Down

0 comments on commit e27c03b

Please sign in to comment.