Skip to content

Commit

Permalink
chore: luals runtime.version only set during check, to prevent lua ve…
Browse files Browse the repository at this point in the history
…rsion 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 eed966d.
  • Loading branch information
alex-courtis authored Oct 28, 2024
1 parent 1403933 commit 8f97487
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
11 changes: 8 additions & 3 deletions scripts/luals-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f97487

Please sign in to comment.