diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index da5e2ae..2ccfc92 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -72,16 +72,41 @@ jobs: - name: Verify Lua Language Server Installation run: ./luals/bin/lua-language-server --version - - name: Update Json With Full Path + - name: Resolve Addon Paths And Update Config run: | - FULL_PATH=$(realpath ./.vscode/lua-addons) - echo "full-path: $FULL_PATH" + ADDONS_PATH=$(realpath ./.vscode/lua-addons) + ADDON_ROOT=$(find "$ADDONS_PATH" -mindepth 1 -maxdepth 1 -type d | head -n 1) + LIBRARY_PATH="$ADDON_ROOT/library" - jq --arg full_path "$FULL_PATH" '.Lua.workspace.library[0] = $full_path' ./.luarc.json > ./.luarc.json.tmp && mv ./.luarc.json.tmp ./.luarc.json + echo "addons-path: $ADDONS_PATH" + echo "addon-root: $ADDON_ROOT" + echo "library-path: $LIBRARY_PATH" + + test -d "$ADDON_ROOT" + test -d "$LIBRARY_PATH" + test -f "$LIBRARY_PATH/DcsTypes.lua" + + jq \ + --arg addons_path "$ADDONS_PATH" \ + --arg addon_root "$ADDON_ROOT" \ + --arg library_path "$LIBRARY_PATH" \ + '.Lua.workspace.library = [$library_path, $addon_root] | .Lua.workspace.userThirdParty = [$addons_path]' \ + ./.luarc.json > ./.luarc.json.tmp && mv ./.luarc.json.tmp ./.luarc.json - name: Show Config run: cat ./.luarc.json + - name: LuaLS Smoke Test For Addon Globals + run: | + cat > ./_luals_smoke_test.lua << 'EOF' + local now = timer.getTime() + local base = Airbase.getByName("TEST") + local side = coalition.side.RED + return now, base, side + EOF + + ./luals/bin/lua-language-server --check ./_luals_smoke_test.lua --checklevel=Warning --configpath ./.luarc.json + - name: Run Lua Language Server run: ./luals/bin/lua-language-server --check ./src --checklevel=Warning --configpath ./.luarc.json