chore: luals runtime.version only set during check, to prevent lua version ambuguity at dev time (#2975)

* chore: luals runtime.version only set during check, to prevent lua version ambuguity at dev time

* inject lua 5.1 check failure

* Revert "inject lua 5.1 check failure"

This reverts commit eed966dc7b.
This commit is contained in:
Alexander Courtis 2024-10-28 11:57:53 +11:00 committed by GitHub
parent 14039337a5
commit 8f974879a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -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",

View File

@ -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