44# luals-out/check.json will be produced on any issues, returning 1.
55# Outputs only check.json to stdout, all other messages to stderr, to allow jq etc.
66# $VIMRUNTIME specifies neovim runtime path, defaults to "/usr/share/nvim/runtime" if unset.
7+ #
8+ # Call with codestyle-check param to enable only codestyle-check
79
810if [ -z " ${VIMRUNTIME} " ]; then
911 export VIMRUNTIME=" /usr/share/nvim/runtime"
@@ -17,11 +19,24 @@ FILE_LUARC="${DIR_OUT}/luarc.json"
1719rm -rf " ${DIR_OUT} "
1820mkdir " ${DIR_OUT} "
1921
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} "
22+ case " ${1} " in
23+ " codestyle-check" )
24+ jq \
25+ ' .diagnostics.neededFileStatus[] = "None" | ' ' .diagnostics.neededFileStatus."codestyle-check" = "Any"' \
26+ " ${PWD} /.luarc.json" > " ${FILE_LUARC} "
2327
24- # execute inside lua to prevent luals itself from being checked
28+ ;;
29+ * )
30+ # Add runtime.version for strict neovim baseline 5.1
31+ # 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
32+ jq \
33+ ' ."runtime.version" = "Lua 5.1"' \
34+ " ${PWD} /.luarc.json" > " ${FILE_LUARC} "
35+
36+ ;;
37+ esac
38+
39+ # execute inside lua directory to prevent luals itself from being checked
2540OUT=$( lua-language-server --check=" ${DIR_SRC} " --configpath=" ${FILE_LUARC} " --checklevel=Information --logpath=" ${DIR_OUT} " --loglevel=error)
2641RC=$?
2742
0 commit comments