tree_sitter_language_pack 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/src/lib.rs +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1e7259fe132cba3251f3091d0092279bd931337574b47fec6ae49466d4a3f37
|
|
4
|
+
data.tar.gz: 45e329b059021638db71ae2906957a8214740ea91f3df74a0ec1a400483e558c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21de754e2c4510102ef74d500c4e8b831453dfca5e5ceb35aa89d82b5c2eafad23cbc3f482945f237058940e0699263b9a7613f0cc8cd525dd67d2eb82364a88
|
|
7
|
+
data.tar.gz: 7a20ec5ba5433e5ae16221fd0f2495e412176be05a2ec96355b55d4e26da12d230a966143da218ae842e8622c0689de8553b78fc4e9ef9610f771467fa442586
|
data/src/lib.rs
CHANGED
|
@@ -50,6 +50,14 @@ fn detect_language_from_content(content: String) -> Option<String> {
|
|
|
50
50
|
tree_sitter_language_pack::detect_language_from_content(&content).map(String::from)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
fn detect_language_from_extension(ext: String) -> Option<String> {
|
|
54
|
+
tree_sitter_language_pack::detect_language_from_extension(&ext).map(String::from)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fn detect_language_from_path(path: String) -> Option<String> {
|
|
58
|
+
tree_sitter_language_pack::detect_language_from_path(&path).map(String::from)
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
/// Returns extension ambiguity information as a JSON string, or nil.
|
|
54
62
|
fn extension_ambiguity(ext: String) -> Option<String> {
|
|
55
63
|
tree_sitter_language_pack::extension_ambiguity_json(&ext)
|
|
@@ -252,6 +260,11 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
252
260
|
"detect_language_from_content",
|
|
253
261
|
function!(detect_language_from_content, 1),
|
|
254
262
|
)?;
|
|
263
|
+
module.define_module_function(
|
|
264
|
+
"detect_language_from_extension",
|
|
265
|
+
function!(detect_language_from_extension, 1),
|
|
266
|
+
)?;
|
|
267
|
+
module.define_module_function("detect_language_from_path", function!(detect_language_from_path, 1))?;
|
|
255
268
|
module.define_module_function("extension_ambiguity", function!(extension_ambiguity, 1))?;
|
|
256
269
|
module.define_module_function("get_highlights_query", function!(get_highlights_query, 1))?;
|
|
257
270
|
module.define_module_function("get_injections_query", function!(get_injections_query, 1))?;
|