Move code index updating to happen to modified buffers on the tick hook. This will unify the separate paths for updating the code index.
This commit is contained in:
parent
94991304b5
commit
b56bd7caa8
|
@ -99,6 +99,7 @@ BUFFER_EDIT_RANGE_SIG(custom_buffer_edit_range){
|
|||
|
||||
Range_i64 old_range = Ii64(old_cursor_range.min.pos, old_cursor_range.max.pos);
|
||||
|
||||
b8 trigger_code_index_update = false;
|
||||
{ // Tree Sitter
|
||||
Buffer_Tree_Sitter_Data* tree_data = scope_attachment(app, scope, buffer_tree_sitter_data_id, Buffer_Tree_Sitter_Data);
|
||||
|
||||
|
@ -131,7 +132,7 @@ BUFFER_EDIT_RANGE_SIG(custom_buffer_edit_range){
|
|||
|
||||
ts_tree_edit(tree_data->tree, &edit);
|
||||
tree_sitter_parse_incremental(app, buffer_id);
|
||||
tree_sitter_code_index_update_full_file(app, buffer_id); // TODO(PS): This should become incremental
|
||||
trigger_code_index_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,6 +245,8 @@ BUFFER_EDIT_RANGE_SIG(custom_buffer_edit_range){
|
|||
|
||||
loco_on_buffer_edit(app, buffer_id, old_range, new_range);
|
||||
|
||||
if (trigger_code_index_update) buffer_mark_as_modified(buffer_id);
|
||||
|
||||
// no meaning for return
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -589,8 +589,9 @@ tree_sitter_code_index_update_tick(Application_Links* app)
|
|||
modified_node = modified_node->next
|
||||
){
|
||||
Buffer_ID buffer_id = modified_node->buffer;
|
||||
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id);
|
||||
printf("%.*s was modified\n", string_expand(buffer_name));
|
||||
|
||||
// TODO(PS): This should become incremental
|
||||
tree_sitter_code_index_update_full_file(app, buffer_id);
|
||||
}
|
||||
buffer_modified_set_clear();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue