From 6cee04350f909c6611258ccaee06446e08218f0c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 9 Jul 2020 13:39:47 -0700 Subject: [PATCH] tags: Expose utf16 column range to C API --- tags/include/tree_sitter/tags.h | 2 ++ tags/src/c_lib.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tags/include/tree_sitter/tags.h b/tags/include/tree_sitter/tags.h index 58f5bbd9..f2b17075 100644 --- a/tags/include/tree_sitter/tags.h +++ b/tags/include/tree_sitter/tags.h @@ -28,6 +28,8 @@ typedef struct { uint32_t line_end_byte; TSPoint start_point; TSPoint end_point; + uint32_t utf16_start_column; + uint32_t utf16_end_column; uint32_t docs_start_byte; uint32_t docs_end_byte; uint32_t syntax_type_id; diff --git a/tags/src/c_lib.rs b/tags/src/c_lib.rs index 77f8aae5..07e1e19a 100644 --- a/tags/src/c_lib.rs +++ b/tags/src/c_lib.rs @@ -36,6 +36,8 @@ pub struct TSTag { pub line_end_byte: u32, pub start_point: TSPoint, pub end_point: TSPoint, + pub utf16_start_colum: u32, + pub utf16_end_colum: u32, pub docs_start_byte: u32, pub docs_end_byte: u32, pub syntax_type_id: u32, @@ -161,6 +163,8 @@ pub extern "C" fn ts_tagger_tag( row: tag.span.end.row as u32, column: tag.span.end.column as u32, }, + utf16_start_colum: tag.utf16_column_range.start as u32, + utf16_end_colum: tag.utf16_column_range.end as u32, docs_start_byte: prev_docs_len as u32, docs_end_byte: buffer.docs.len() as u32, syntax_type_id: tag.syntax_type_id, @@ -225,7 +229,7 @@ pub extern "C" fn ts_tagger_syntax_kinds_for_scope_name( *len = 0; if let Some(config) = tagger.languages.get(scope_name) { *len = config.c_syntax_type_names.len() as u32; - return config.c_syntax_type_names.as_ptr() as *const *const i8 + return config.c_syntax_type_names.as_ptr() as *const *const i8; } std::ptr::null() }