From 53d178dbf217632824a8f0abd6bc19d433d84605 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 28 Oct 2024 11:52:17 +1100 Subject: [PATCH 1/3] chore: luals runtime.version only set during check, to prevent lua version ambuguity at dev time --- .luarc.json | 2 +- scripts/luals-check.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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 From eed966dc7b748a6ab3ed45ff5faba2f33ea3f29b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 28 Oct 2024 11:55:15 +1100 Subject: [PATCH 2/3] inject lua 5.1 check failure --- lua/nvim-tree.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 4390adcf35b..f6faf57a2f3 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -1,3 +1,5 @@ +local _ = table.pack({}) + local log = require("nvim-tree.log") local view = require("nvim-tree.view") local utils = require("nvim-tree.utils") From 8d4a13e4467377770ac11169ca148374ff0250df Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 28 Oct 2024 11:56:58 +1100 Subject: [PATCH 3/3] Revert "inject lua 5.1 check failure" This reverts commit eed966dc7b748a6ab3ed45ff5faba2f33ea3f29b. --- lua/nvim-tree.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index f6faf57a2f3..4390adcf35b 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -1,5 +1,3 @@ -local _ = table.pack({}) - local log = require("nvim-tree.log") local view = require("nvim-tree.view") local utils = require("nvim-tree.utils")