test: add luals checking

This commit is contained in:
Lewis Russell 2024-04-17 10:22:45 +01:00 committed by Lewis Russell
parent 05226b4d41
commit 099784ef4d
8 changed files with 29 additions and 3 deletions

2
.gitignore vendored
View file

@ -2,6 +2,8 @@ doc/tags
scratch/dummy_ignored.txt
luals
nvim-test
stylua

View file

@ -15,6 +15,7 @@
"checkThirdParty": false
},
"diagnostics": {
"libraryFiles": "Disable",
"groupFileStatus": {
"strict": "Opened",
"strong": "Opened",

View file

@ -75,3 +75,20 @@ build: gen_help stylua-run
doc-check: gen_help
git diff --exit-code -- doc
LUALS_VERSION := 3.7.4
LUALS_TARBALL := lua-language-server-$(LUALS_VERSION)-$(shell uname -s)-$(shell uname -m).tar.gz
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(LUALS_TARBALL)
luals:
wget $(LUALS_URL)
mkdir luals
tar -xf $(LUALS_TARBALL) -C luals
rm -rf $(LUALS_TARBALL)
.PHONY: luals-check
luals-check: luals nvim-test
VIMRUNTIME=$(XDG_DATA_HOME)/nvim-test/nvim-test-$(NVIM_TEST_VERSION)/share/nvim/runtime \
lua-language-server \
--logpath=. \
--configpath=../.luarc.json \
--check=lua

View file

@ -268,6 +268,8 @@ end
--- Stage all contiguous hunks. Only useful if 'diff_opts'
--- contains `linematch`. Defaults to `true`.
M.stage_hunk = mk_repeatable(async.create(2, function(range, opts)
--- @cast range {[1]: integer, [2]: integer}?
opts = opts or {}
local bufnr = current_buf()
local bcache = cache[bufnr]
@ -334,6 +336,8 @@ end
--- Stage all contiguous hunks. Only useful if 'diff_opts'
--- contains `linematch`. Defaults to `true`.
M.reset_hunk = mk_repeatable(async.create(2, function(range, opts)
--- @cast range {[1]: integer, [2]: integer}?
opts = opts or {}
local bufnr = current_buf()
local bcache = cache[bufnr]

View file

@ -6,6 +6,7 @@ end
-- Return positional arguments and named arguments
--- @param x string
--- @return string[], table<string,string|boolean>
function M.parse_args(x)
--- @type string[], table<string,string|boolean>
local pos_args, named_args = {}, {}

View file

@ -6,6 +6,7 @@ local M = {}
--- @param path string[]
--- @return any
local function process(raw_item, path)
--- @diagnostic disable-next-line:undefined-field
if path[#path] == vim.inspect.METATABLE then
return nil
elseif type(raw_item) == 'function' then

View file

@ -255,8 +255,8 @@ function M.create_patch(relpath, hunks, mode_bits, invert)
local now_lines = process_hunk.added.lines
if invert then
pre_count, now_count = now_count, pre_count
pre_lines, now_lines = now_lines, pre_lines
pre_count, now_count = now_count, pre_count --- @type integer, integer
pre_lines, now_lines = now_lines, pre_lines --- @type string[], string[]
end
table.insert(

View file

@ -5,7 +5,7 @@ local M = {}
local system = vim.system or require('gitsigns.system.compat')
--- @param cmd string[]
--- @param opts SystemOpts
--- @param opts vim.SystemOpts
--- @param on_exit fun(obj: vim.SystemCompleted)
--- @return vim.SystemObj
function M.system(cmd, opts, on_exit)