mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-02 09:04:54 +02:00
plugin/efmls-configs: init + tests (#542)
This commit is contained in:
parent
c4354ea9ec
commit
4cd3707e00
7 changed files with 630 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
pkgs: rec {
|
||||
rust-analyzer-config = pkgs.callPackage ./rust-analyzer {};
|
||||
efmls-configs-tools = pkgs.callPackage ./efmls-configs {};
|
||||
autogenerated-configs = pkgs.callPackage ({stdenv}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "autogenerated-configs";
|
||||
|
@ -11,6 +12,7 @@ pkgs: rec {
|
|||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${rust-analyzer-config}/share/* $out
|
||||
cp ${efmls-configs-tools}/share/* $out
|
||||
'';
|
||||
}) {};
|
||||
}
|
||||
|
|
37
helpers/efmls-configs/default.nix
Normal file
37
helpers/efmls-configs/default.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
stdenv,
|
||||
python3,
|
||||
vimPlugins,
|
||||
}: let
|
||||
extract = stdenv.mkDerivation {
|
||||
pname = "extract_efmls_tools";
|
||||
version = "1";
|
||||
|
||||
src = ./extract.py;
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
|
||||
buildInputs = [python3];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp $src $out/bin/extract_efmls_tools.py
|
||||
'';
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "efmls-configs-tools";
|
||||
inherit (vimPlugins.efmls-configs-nvim) version src;
|
||||
|
||||
nativeBuildInputs = [extract];
|
||||
|
||||
buildPhase = ''
|
||||
extract_efmls_tools.py ./lua/efmls-configs > efmls-configs-tools.json
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share
|
||||
cp efmls-configs-tools.json $out/share
|
||||
'';
|
||||
}
|
25
helpers/efmls-configs/extract.py
Executable file
25
helpers/efmls-configs/extract.py
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
tool_path = sys.argv[1]
|
||||
|
||||
tools = {
|
||||
"linters": {},
|
||||
"formatters": {},
|
||||
}
|
||||
|
||||
for kind in ["linters", "formatters"]:
|
||||
for file in os.listdir(tool_path + "/" + kind):
|
||||
tool_name = file.removesuffix(".lua")
|
||||
languages = []
|
||||
with open(tool_path + "/" + kind + "/" + file) as f:
|
||||
for line in f.readlines():
|
||||
if line.startswith("-- languages:"):
|
||||
languages = line.split(":")[1].strip().split(",")
|
||||
break
|
||||
tools[kind][tool_name] = languages
|
||||
|
||||
print(json.dumps(tools, indent=4))
|
Loading…
Add table
Add a link
Reference in a new issue