Skip to content

Commit 2cb16dd

Browse files
committed
attempt to use emmylua_check for type checking
1 parent 4825177 commit 2cb16dd

File tree

4 files changed

+29
-18
lines changed

4 files changed

+29
-18
lines changed

.emmyrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"runtime": {
3+
"version": "LuaJIT",
4+
"requirePattern": ["lua/?.lua", "lua/?/init.lua"]
5+
},
6+
"workspace": {
7+
"library": ["$VIMRUNTIME", "$LLS_Addons/luvit"]
8+
}
9+
}

.github/workflows/.luarc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,28 @@ jobs:
3737
version: latest
3838
args: --check .
3939

40-
typecheck:
40+
typecheck-emmylua:
4141
name: Typecheck sources
4242
strategy:
4343
matrix:
4444
os: [ubuntu-latest]
4545
neovim_version: ["v0.11.0"]
4646
runs-on: ${{ matrix.os }}
4747
steps:
48-
- name: Checkout sources
49-
uses: actions/checkout@v4
50-
- name: Type Check Code Base
51-
uses: stevearc/nvim-typecheck-action@v2
48+
- name: Install emmylua_check from crates.io
49+
uses: baptiste0928/cargo-install@v3
50+
with:
51+
crate: emmylua_check
52+
version: '^0.10.0'
53+
- name: Setup neovim
54+
uses: rhysd/action-setup-vim@v1
5255
with:
53-
configpath: .github/workflows/.luarc.json
54-
path: lua
55-
level: Warning
56-
nvim-version: v0.11.0
56+
neovim: true
57+
version: ${{ matrix.neovim_version }}
58+
- uses: actions/checkout@v4
59+
# TODO (sbadragan): need to fetch LLS_Addons -> luvit library as well
60+
- name: Run emmylua_check
61+
run: |
62+
export VIMRUNTIME=$( nvim -u NORC --headless -c 'echo $VIMRUNTIME' -c 'q' 2>&1)
63+
echo $VIMRUNTIME
64+
emmylua_check -c .emmyrc.json ./lua ./tests

lua/grug-far/test/helpers.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function M.getBufExtmarksVirtText(buf, namespaceName)
2424

2525
for i = 1, #marks do
2626
local _, _, _, details = unpack(marks[i])
27+
---@diagnostic disable-next-line: need-check-nil
2728
local virt_lines = details.virt_lines
2829
if virt_lines then
2930
for j = 1, #virt_lines do
@@ -36,6 +37,7 @@ function M.getBufExtmarksVirtText(buf, namespaceName)
3637
end
3738
end
3839

40+
---@diagnostic disable-next-line: need-check-nil
3941
local virt_text = details.virt_text
4042
if virt_text then
4143
for l = 1, #virt_text do
@@ -248,7 +250,7 @@ end
248250

249251
--- writes files given based on given spec to temp test dir
250252
--- clears out temp test dir beforehand
251-
---@param files {[string]: string}
253+
---@param files {filename: string, content: string}[]
252254
---@param dirs? string[]
253255
function M.writeTestFiles(files, dirs)
254256
vim.fn.delete('./temp_test_dir', 'rf')

0 commit comments

Comments
 (0)