aboutsummaryrefslogtreecommitdiff
path: root/helix-syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-syntax/src')
-rw-r--r--helix-syntax/src/lib.rs31
1 files changed, 0 insertions, 31 deletions
diff --git a/helix-syntax/src/lib.rs b/helix-syntax/src/lib.rs
deleted file mode 100644
index b0ec48d8..00000000
--- a/helix-syntax/src/lib.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-use anyhow::{Context, Result};
-use libloading::{Library, Symbol};
-use tree_sitter::Language;
-
-fn replace_dashes_with_underscores(name: &str) -> String {
- name.replace('-', "_")
-}
-#[cfg(unix)]
-const DYLIB_EXTENSION: &str = "so";
-
-#[cfg(windows)]
-const DYLIB_EXTENSION: &str = "dll";
-
-pub fn get_language(runtime_path: &std::path::Path, name: &str) -> Result<Language> {
- let name = name.to_ascii_lowercase();
- let mut library_path = runtime_path.join("grammars").join(&name);
- // TODO: duplicated under build
- library_path.set_extension(DYLIB_EXTENSION);
-
- let library = unsafe { Library::new(&library_path) }
- .with_context(|| format!("Error opening dynamic library {:?}", &library_path))?;
- let language_fn_name = format!("tree_sitter_{}", replace_dashes_with_underscores(&name));
- let language = unsafe {
- let language_fn: Symbol<unsafe extern "C" fn() -> Language> = library
- .get(language_fn_name.as_bytes())
- .with_context(|| format!("Failed to load symbol {}", language_fn_name))?;
- language_fn()
- };
- std::mem::forget(library);
- Ok(language)
-}