Merge branch 'main' into main

This commit is contained in:
Johnston Liu 2025-10-09 16:52:40 -04:00 committed by GitHub
commit b870e65f95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 41 additions and 2439 deletions

File diff suppressed because it is too large Load diff

View file

@ -61,7 +61,11 @@ end
---@return string ---@return string
function M.extract(file, pattern) function M.extract(file, pattern)
local init = Util.read_file(file) local init = Util.read_file(file)
return assert(init:match(pattern)) local ret = assert(init:match(pattern)) --[[@as string]]
local lines = vim.tbl_filter(function(line)
return not line:find("^%s*%-%-%s*stylua%s*:%s*ignore%s*$")
end, vim.split(ret, "\n"))
return table.concat(lines, "\n")
end end
---@return ReadmeBlock ---@return ReadmeBlock

View file

@ -33,11 +33,14 @@ function M.setup(opts)
local args = {} local args = {}
local is_busted = false local is_busted = false
local is_minitest = false local is_minitest = false
local offline = vim.env.LAZY_OFFLINE == "1" or vim.env.LAZY_OFFLINE == "true"
for _, a in ipairs(_G.arg) do for _, a in ipairs(_G.arg) do
if a == "--busted" then if a == "--busted" then
is_busted = true is_busted = true
elseif a == "--minitest" then elseif a == "--minitest" then
is_minitest = true is_minitest = true
elseif a == "--offline" then
offline = true
else else
table.insert(args, a) table.insert(args, a)
end end
@ -62,7 +65,9 @@ function M.setup(opts)
if vim.g.colors_name == nil then if vim.g.colors_name == nil then
vim.cmd("colorscheme habamax") vim.cmd("colorscheme habamax")
end end
require("lazy").update():wait() if not offline then
require("lazy").update():wait()
end
if vim.bo.filetype == "lazy" then if vim.bo.filetype == "lazy" then
local errors = false local errors = false
for _, plugin in pairs(require("lazy.core.config").spec.plugins) do for _, plugin in pairs(require("lazy.core.config").spec.plugins) do
@ -150,7 +155,7 @@ function M.minitest.setup(opts)
opts = { opts = {
collect = { collect = {
find_files = function() find_files = function()
return vim.fn.globpath("tests", "**/*_spec.lua", true, true) return #_G.arg > 0 and _G.arg or vim.fn.globpath("tests", "**/*_spec.lua", true, true)
end, end,
}, },
-- script_path = "tests/minit.lua", -- script_path = "tests/minit.lua",

View file

@ -63,6 +63,9 @@ function M.update()
pkg.spec = { _raw = spec.code } pkg.spec = { _raw = spec.code }
end end
table.insert(ret.pkgs, pkg) table.insert(ret.pkgs, pkg)
if not plugin._.pkg and plugin._.loaded and pkg.source == "rockspec" then
require("lazy.core.loader").add_to_luapath(plugin)
end
break break
end end
end end

View file

@ -35,11 +35,10 @@ function M.cputime()
if M.C == nil then if M.C == nil then
pcall(function() pcall(function()
ffi.cdef([[ ffi.cdef([[
typedef long time_t;
typedef int clockid_t; typedef int clockid_t;
typedef struct timespec { typedef struct timespec {
time_t tv_sec; /* seconds */ int64_t tv_sec; /* Use fixed 64-bit type for portability */
long tv_nsec; /* nanoseconds */ long tv_nsec; /* nanoseconds */
} nanotime; } nanotime;
int clock_gettime(clockid_t clk_id, struct timespec *tp); int clock_gettime(clockid_t clk_id, struct timespec *tp);
]]) ]])
@ -48,7 +47,8 @@ function M.cputime()
end end
local function real() local function real()
local pnano = assert(ffi.new("nanotime[?]", 1)) -- Zero-initialize to handle 32-bit systems where only lower 32 bits are written
local pnano = ffi.new("nanotime[1]")
local CLOCK_PROCESS_CPUTIME_ID = jit.os == "OSX" and 12 or 2 local CLOCK_PROCESS_CPUTIME_ID = jit.os == "OSX" and 12 or 2
ffi.C.clock_gettime(CLOCK_PROCESS_CPUTIME_ID, pnano) ffi.C.clock_gettime(CLOCK_PROCESS_CPUTIME_ID, pnano)
return tonumber(pnano[0].tv_sec) * 1e3 + tonumber(pnano[0].tv_nsec) / 1e6 return tonumber(pnano[0].tv_sec) * 1e3 + tonumber(pnano[0].tv_nsec) / 1e6

View file

@ -1,3 +1,3 @@
#!/bin/env bash #!/usr/bin/env bash
nvim -l tests/minit.lua --minitest nvim -l tests/minit.lua --minitest "$@"

View file

@ -1,21 +0,0 @@
[selene]
base = "lua51"
name = "vim"
[vim]
any = true
[jit]
any = true
[assert]
any = true
[describe]
any = true
[it]
any = true
[before_each.args]
any = true

19
vim.yml Normal file
View file

@ -0,0 +1,19 @@
base: lua51
lua_versions:
- luajit
globals:
Snacks:
any: true
vim:
any: true
jit:
any: true
assert:
any: true
describe:
any: true
it:
any: true
before_each:
any: true