Skip to content

Commit 8f97487

Browse files
authored
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 eed966d.
1 parent 1403933 commit 8f97487

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.luarc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
3-
"runtime.version": "Lua 5.1",
3+
"runtime.version.luals-check-only": "Lua 5.1",
44
"workspace": {
55
"library": [
66
"$VIMRUNTIME/lua/vim",

scripts/luals-check.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@ if [ -z "${VIMRUNTIME}" ]; then
99
export VIMRUNTIME="/usr/share/nvim/runtime"
1010
fi
1111

12-
DIR_SRC="lua"
13-
DIR_OUT="luals-out"
12+
DIR_SRC="${PWD}/lua"
13+
DIR_OUT="${PWD}/luals-out"
14+
FILE_LUARC="${DIR_OUT}/luarc.json"
1415

1516
# clear output
1617
rm -rf "${DIR_OUT}"
1718
mkdir "${DIR_OUT}"
1819

20+
# Uncomment runtime.version for strict neovim baseline 5.1
21+
# 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()
22+
cat "${PWD}/.luarc.json" | sed -E 's/.luals-check-only//g' > "${FILE_LUARC}"
23+
1924
# execute inside lua to prevent luals itself from being checked
20-
OUT=$(lua-language-server --check="${DIR_SRC}" --configpath="${PWD}/.luarc.json" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error)
25+
OUT=$(lua-language-server --check="${DIR_SRC}" --configpath="${FILE_LUARC}" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error)
2126
RC=$?
2227

2328
echo "${OUT}" >&2

0 commit comments

Comments
 (0)