diff --git a/.luarc.json b/.luarc.json index b1f121b29ac..bb0a84b9687 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", - "runtime.version": "Lua 5.1", + "runtime.version.luals-check-only": "Lua 5.1", "workspace": { "library": [ "$VIMRUNTIME/lua/vim", diff --git a/scripts/luals-check.sh b/scripts/luals-check.sh index 0c49f6a5df4..6c562b620cf 100755 --- a/scripts/luals-check.sh +++ b/scripts/luals-check.sh @@ -9,15 +9,20 @@ if [ -z "${VIMRUNTIME}" ]; then export VIMRUNTIME="/usr/share/nvim/runtime" fi -DIR_SRC="lua" -DIR_OUT="luals-out" +DIR_SRC="${PWD}/lua" +DIR_OUT="${PWD}/luals-out" +FILE_LUARC="${DIR_OUT}/luarc.json" # clear output rm -rf "${DIR_OUT}" mkdir "${DIR_OUT}" +# Uncomment runtime.version for strict neovim baseline 5.1 +# It is not set normally, to prevent luals loading 5.1 and 5.x, resulting in both versions being chosen on vim.lsp.buf.definition() +cat "${PWD}/.luarc.json" | sed -E 's/.luals-check-only//g' > "${FILE_LUARC}" + # execute inside lua to prevent luals itself from being checked -OUT=$(lua-language-server --check="${DIR_SRC}" --configpath="${PWD}/.luarc.json" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error) +OUT=$(lua-language-server --check="${DIR_SRC}" --configpath="${FILE_LUARC}" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error) RC=$? echo "${OUT}" >&2