Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .emmyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
"format": {
"externalTool": {
"program": "stylua",
"args": [
"-",
"--stdin-filepath",
"${file}"
]
}
},
"diagnostics": {
"disable": [
"unnecessary-if"
]
},
"codeAction": {
"insertSpace": true
},
"strict": {
"typeCall": true,
"arrayIndex": true
}
}
14 changes: 11 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
sudo luarocks install luacheck
- name: Lint
run: sudo make lint
run: make lint

stylua:
name: stylua
name: Stylua
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: This requires adapting the branch protection (required checks are case sensitive).

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
Expand All @@ -35,4 +35,12 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
# CLI arguments
args: --color always --check lua/
args: --color always --check .

luals:
name: Luals
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: make checklua

27 changes: 27 additions & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
"runtime": {
"version": "LuaJIT"
},
"workspace": {
"library": [
"$VIMRUNTIME"
],
"ignoreDir": [
".test-deps",
"lua/tests"
],
"checkThirdParty": "Disable"
},
"diagnostics": {
"groupFileStatus": {
"strict": "Opened",
"strong": "Opened"
},
"groupSeverity": {
"strong": "Warning",
"strict": "Warning"
},
"unusedLocalExclude": [ "_*" ]
}
}
77 changes: 75 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,83 @@
.PHONY: test lint docgen
NVIM_VERSION ?= nightly
LUALS_VERSION := 3.15.0

DEPDIR ?= .test-deps
CURL ?= curl -sL --create-dirs

ifeq ($(shell uname -s),Darwin)
NVIM_ARCH ?= macos-arm64
LUALS_ARCH ?= darwin-arm64
STYLUA_ARCH ?= macos-aarch64
else
NVIM_ARCH ?= linux-x86_64
LUALS_ARCH ?= linux-x64
STYLUA_ARCH ?= linux-x86_64
endif

# download test dependencies

NVIM := $(DEPDIR)/nvim-$(NVIM_ARCH)
NVIM_TARBALL := $(NVIM).tar.gz
NVIM_URL := https://github.com/neovim/neovim/releases/download/$(NVIM_VERSION)/$(notdir $(NVIM_TARBALL))
NVIM_BIN := $(NVIM)/nvim-$(NVIM_ARCH)/bin/nvim
NVIM_RUNTIME=$(NVIM)/nvim-$(NVIM_ARCH)/share/nvim/runtime

.PHONY: nvim
nvim: $(NVIM)

$(NVIM):
$(CURL) $(NVIM_URL) -o $(NVIM_TARBALL)
mkdir $@
tar -xf $(NVIM_TARBALL) -C $@
rm -rf $(NVIM_TARBALL)

LUALS := $(DEPDIR)/lua-language-server-$(LUALS_VERSION)-$(LUALS_ARCH)
LUALS_TARBALL := $(LUALS).tar.gz
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(notdir $(LUALS_TARBALL))

.PHONY: luals
luals: $(LUALS)

$(LUALS):
$(CURL) $(LUALS_URL) -o $(LUALS_TARBALL)
mkdir $@
tar -xf $(LUALS_TARBALL) -C $@
rm -rf $(LUALS_TARBALL)

STYLUA := $(DEPDIR)/stylua-$(STYLUA_ARCH)
STYLUA_TARBALL := $(STYLUA).zip
STYLUA_URL := https://github.com/JohnnyMorganz/StyLua/releases/latest/download/$(notdir $(STYLUA_TARBALL))

.PHONY: stylua
stylua: $(STYLUA)

$(STYLUA):
$(CURL) $(STYLUA_URL) -o $(STYLUA_TARBALL)
unzip $(STYLUA_TARBALL) -d $(STYLUA)
rm -rf $(STYLUA_TARBALL)

.PHONY: formatlua
formatlua: $(STYLUA)
$(STYLUA)/stylua .

.PHONY: checklua
checklua: $(LUALS) $(NVIM)
VIMRUNTIME=$(NVIM_RUNTIME) $(LUALS)/bin/lua-language-server \
--configpath=../.luarc.json \
--check=./

.PHONY: test
test:
nvim --headless --noplugin -u scripts/minimal_init.vim -c "PlenaryBustedDirectory lua/tests/automated/ { minimal_init = './scripts/minimal_init.vim' }"

lint:
.PHONY: lint
luacheck:
luacheck lua/telescope

.PHONY: docgen
docgen:
nvim --headless --noplugin -u scripts/minimal_init.vim -c "luafile ./scripts/gendocs.lua" -c 'qa'

.PHONY: clean
clean:
rm -rf $(DEPDIR)
Loading