Skip to content

Commit

Permalink
Merge pull request #327 from mrcjkb/lua-ls-shellhook-fix
Browse files Browse the repository at this point in the history
fix(lua-ls): update + shell hook
  • Loading branch information
domenkozar authored Jul 17, 2023
2 parents 5e28316 + 09214ad commit 87589fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -662,19 +662,27 @@ in
};
lua-ls =
let
# .luarc.json has to be in a directory,
# or lua-language-server will hang forever.
luarc = pkgs.writeText ".luarc.json" (builtins.toJSON settings.lua-ls.config);
luarc-dir = pkgs.stdenv.mkDerivation {
name = "luarc";
unpackPhase = "true";
installPhase = ''
mkdir $out
cp ${luarc} $out/.luarc.json
'';
};
script = pkgs.writeShellApplication {
name = "lua-ls-lint";
runtimeInputs = [ tools.lua-language-server ];
checkPhase = ""; # The default checkPhase depends on GHC
text = ''
set -e
export logpath="$(mktemp -d)"
# For some reason, lua-language-server hangs if the nix store path to the file is passed in directly
cp "${luarc}" .luarc.json
lua-language-server --check $(realpath .) \
--checklevel="${settings.lua-ls.checklevel}" \
--configpath=$(realpath .luarc.json) \
--configpath="${luarc-dir}/.luarc.json" \
--logpath="$logpath"
if [[ -f $logpath/check.json ]]; then
echo "+++++++++++++++ lua-language-server diagnostics +++++++++++++++"
Expand Down
4 changes: 2 additions & 2 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
, html-tidy
, hunspell
, luaPackages
, sumneko-lua-language-server
, lua-language-server
, mdsh
, nil
, nixfmt
Expand Down Expand Up @@ -119,7 +119,7 @@ in
inherit (luaPackages) luacheck;
inherit (nodePackages) eslint markdownlint-cli prettier cspell;
inherit (ocamlPackages) ocp-indent;
lua-language-server = sumneko-lua-language-server;
lua-language-server = lua-language-server;
purs-tidy = nodePackages.purs-tidy or null;
cabal2nix-dir = callPackage ./cabal2nix-dir { };
hpack-dir = callPackage ./hpack-dir { };
Expand Down

0 comments on commit 87589fa

Please sign in to comment.