4
4
# luals-out/check.json will be produced on any issues, returning 1.
5
5
# Outputs only check.json to stdout, all other messages to stderr, to allow jq etc.
6
6
# $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
7
9
8
10
if [ -z " ${VIMRUNTIME} " ]; then
9
11
export VIMRUNTIME=" /usr/share/nvim/runtime"
@@ -17,11 +19,24 @@ FILE_LUARC="${DIR_OUT}/luarc.json"
17
19
rm -rf " ${DIR_OUT} "
18
20
mkdir " ${DIR_OUT} "
19
21
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} "
23
27
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
25
40
OUT=$( lua-language-server --check=" ${DIR_SRC} " --configpath=" ${FILE_LUARC} " --checklevel=Information --logpath=" ${DIR_OUT} " --loglevel=error)
26
41
RC=$?
27
42
0 commit comments