Add agda, nix

This commit is contained in:
xenia 2023-11-12 14:36:27 +01:00
parent d62b1657c3
commit 0acc4dbba4
4 changed files with 16 additions and 3 deletions

View File

@ -65,4 +65,5 @@ ruby = []
rust = []
scala = []
typescript = []
nix = []
agda = []

View File

@ -45,6 +45,10 @@ fn main() {
"scala",
#[cfg(feature = "typescript")]
"typescript",
#[cfg(feature = "nix")]
"nix",
#[cfg(feature = "agda")]
"agda",
] {
println!("cargo:rustc-link-lib=static=tree-sitter-{lang}");
}

View File

@ -22,14 +22,14 @@
};
sitters = tree-sitters.packages.${sys};
sitterlist = [
sitters.agda sitters.bash sitters.c sitters.nix sitters.python sitters.rust
sitters.bash sitters.c sitters.python sitters.rust sitters.nix sitters.agda
];
kak-tree-bin = platform.buildRustPackage {
name = "kak-tree-bin";
src = ./.;
cargoLock = { lockFile = ./Cargo.lock; };
buildFeatures = ["bash" "c" "python" "rust"]; # TODO: Add agda, nix
buildFeatures = ["bash" "c" "python" "rust" "nix" "agda"];
inherit sitterlist;
preBuild = ''
mkdir lib

View File

@ -45,6 +45,10 @@ extern "C" {
fn tree_sitter_scala() -> Language;
#[cfg(feature = "typescript")]
fn tree_sitter_typescript() -> Language;
#[cfg(feature = "nix")]
fn tree_sitter_nix() -> Language;
#[cfg(feature = "agda")]
fn tree_sitter_agda() -> Language;
}
pub fn filetype_to_language(filetype: &str) -> Option<Language> {
@ -93,6 +97,10 @@ pub fn filetype_to_language(filetype: &str) -> Option<Language> {
"scala" => tree_sitter_scala,
#[cfg(feature = "typescript")]
"typescript" => tree_sitter_typescript,
#[cfg(feature = "nix")]
"nix" => tree_sitter_nix,
#[cfg(feature = "agda")]
"agda" => tree_sitter_agda,
_ => return None,
};
Some(unsafe { sitter() })