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 = [] rust = []
scala = [] scala = []
typescript = [] typescript = []
nix = []
agda = []

View File

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

View File

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

View File

@ -45,6 +45,10 @@ extern "C" {
fn tree_sitter_scala() -> Language; fn tree_sitter_scala() -> Language;
#[cfg(feature = "typescript")] #[cfg(feature = "typescript")]
fn tree_sitter_typescript() -> Language; 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> { 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, "scala" => tree_sitter_scala,
#[cfg(feature = "typescript")] #[cfg(feature = "typescript")]
"typescript" => tree_sitter_typescript, "typescript" => tree_sitter_typescript,
#[cfg(feature = "nix")]
"nix" => tree_sitter_nix,
#[cfg(feature = "agda")]
"agda" => tree_sitter_agda,
_ => return None, _ => return None,
}; };
Some(unsafe { sitter() }) Some(unsafe { sitter() })