Compare commits
3 Commits
1507f414b1
...
504d902ddd
Author | SHA1 | Date |
---|---|---|
|
504d902ddd | |
|
4d356ef7b9 | |
|
507f4a9d04 |
|
@ -208,20 +208,6 @@ code_index_unlock(void){
|
||||||
system_mutex_release(global_code_index.mutex);
|
system_mutex_release(global_code_index.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
function void
|
|
||||||
code_index__hash_file(Code_Index_File *file){
|
|
||||||
// TODO(PS): @RemoveWholeFileHashing - this isn't necessary since, to support incremental updates
|
|
||||||
// we insert nodes into the hash table when the node is created
|
|
||||||
#if 0
|
|
||||||
for (Code_Index_Note *node = file->note_list.first;
|
|
||||||
node != 0;
|
|
||||||
node = node->next){
|
|
||||||
Code_Index_Note_List_New *list = code_index__list_from_string(node->text);
|
|
||||||
code_index_note_list_hash_insert(list, list->sentinel_last.prev_in_hash, node);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
function void
|
function void
|
||||||
code_index__clear_file(Code_Index_File *file){
|
code_index__clear_file(Code_Index_File *file){
|
||||||
for (Code_Index_Note *node = file->note_list.first;
|
for (Code_Index_Note *node = file->note_list.first;
|
||||||
|
@ -249,8 +235,6 @@ code_index_set_file(Buffer_ID buffer, Arena arena, Code_Index_File *index){
|
||||||
}
|
}
|
||||||
storage->arena = arena;
|
storage->arena = arena;
|
||||||
storage->file = index;
|
storage->file = index;
|
||||||
|
|
||||||
code_index__hash_file(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function void
|
function void
|
||||||
|
@ -387,8 +371,6 @@ code_index_shift_list(Code_Index_Note_List *list, Range_i64 old_range, u64 new_s
|
||||||
function void
|
function void
|
||||||
code_index_shift(Code_Index_File *file, Range_i64 old_range, u64 new_size)
|
code_index_shift(Code_Index_File *file, Range_i64 old_range, u64 new_size)
|
||||||
{
|
{
|
||||||
// TODO(PS): @DontShiftNestList - This is unnecessary now that nest_list just gets fully rebuilt each edit
|
|
||||||
code_index_shift_list(&file->nest_list, old_range, new_size);
|
|
||||||
code_index_shift_list(&file->scope_delim_list, old_range, new_size);
|
code_index_shift_list(&file->scope_delim_list, old_range, new_size);
|
||||||
code_index_shift_list(&file->note_list, old_range, new_size);
|
code_index_shift_list(&file->note_list, old_range, new_size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,8 @@ BUFFER_HOOK_SIG(custom_begin_buffer){
|
||||||
|
|
||||||
if (treat_as_code)
|
if (treat_as_code)
|
||||||
{
|
{
|
||||||
// TODO(PS): @AsyncrifyThis???
|
Async_Task* parse_task_ptr = scope_attachment(app, scope, buffer_parse_task, Async_Task);
|
||||||
tree_sitter_parse_incremental(app, buffer_id);
|
*parse_task_ptr = async_task_no_dep(&global_async_system, tree_sitter_parse_full_file_async, make_data_struct(&buffer_id));
|
||||||
tree_sitter_code_index_update_full_file(app, buffer_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String_Const_u8 buffer_name = push_buffer_base_name(app, scratch, buffer_id);
|
String_Const_u8 buffer_name = push_buffer_base_name(app, scratch, buffer_id);
|
||||||
|
|
|
@ -325,6 +325,10 @@ tree_sitter_parse_full_file_async(Async_Context* actx, String_Const_u8 data)
|
||||||
ts_tree_delete(old_buffer_tree);
|
ts_tree_delete(old_buffer_tree);
|
||||||
}
|
}
|
||||||
tree_sitter_parse_state_destroy(&parse_state);
|
tree_sitter_parse_state_destroy(&parse_state);
|
||||||
|
|
||||||
|
Managed_Scope scope = buffer_get_managed_scope(app, buffer_id);
|
||||||
|
Async_Task* code_index_update_task_ptr = scope_attachment(app, scope, buffer_update_code_index_task, Async_Task);
|
||||||
|
*code_index_update_task_ptr = async_task_no_dep(&global_async_system, tree_sitter_code_index_update_async, make_data_struct(&buffer_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
function void
|
function void
|
||||||
|
@ -779,6 +783,16 @@ tree_sitter_code_index_update_tick(Application_Links* app)
|
||||||
ProfileScope(app, "Incremental Parse");
|
ProfileScope(app, "Incremental Parse");
|
||||||
Buffer_ID buffer_id = modified_node->buffer;
|
Buffer_ID buffer_id = modified_node->buffer;
|
||||||
Managed_Scope buffer_scope = buffer_get_managed_scope(app, buffer_id);
|
Managed_Scope buffer_scope = buffer_get_managed_scope(app, buffer_id);
|
||||||
|
|
||||||
|
Async_Task* async_parse_task = scope_attachment(app, buffer_scope, buffer_parse_task, Async_Task);
|
||||||
|
Async_Task* async_code_index_update_task = scope_attachment(app, buffer_scope, buffer_update_code_index_task, Async_Task);
|
||||||
|
if (async_task_is_running_or_pending(&global_async_system, *async_parse_task)) {
|
||||||
|
async_task_wait(app, &global_async_system, *async_parse_task);
|
||||||
|
}
|
||||||
|
if (async_task_is_running_or_pending(&global_async_system, *async_code_index_update_task)) {
|
||||||
|
async_task_wait(app, &global_async_system, *async_code_index_update_task);
|
||||||
|
}
|
||||||
|
|
||||||
Buffer_Tree_Sitter_Data* tree_data = scope_attachment(app, buffer_scope, buffer_tree_sitter_data_id, Buffer_Tree_Sitter_Data);
|
Buffer_Tree_Sitter_Data* tree_data = scope_attachment(app, buffer_scope, buffer_tree_sitter_data_id, Buffer_Tree_Sitter_Data);
|
||||||
if (!tree_data || !tree_data->tree) continue;
|
if (!tree_data || !tree_data->tree) continue;
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ struct Tree_Sitter_Code_Index_Update_State
|
||||||
global Tree_Sitter_Languages tree_sitter_languages;
|
global Tree_Sitter_Languages tree_sitter_languages;
|
||||||
|
|
||||||
CUSTOM_ID(attachment, buffer_tree_sitter_data_id);
|
CUSTOM_ID(attachment, buffer_tree_sitter_data_id);
|
||||||
CUSTOM_ID(attachment, buffer_tree_sitter_parse_task_id);
|
CUSTOM_ID(attachment, buffer_parse_task);
|
||||||
CUSTOM_ID(attachment, buffer_tree_sitter_update_code_index_task_id);
|
CUSTOM_ID(attachment, buffer_update_code_index_task);
|
||||||
|
|
||||||
b8 use_tree_sitter_code_indexing = true;
|
b8 use_tree_sitter_code_indexing = true;
|
||||||
b8 use_tree_sitter_token_coloring = true;
|
b8 use_tree_sitter_token_coloring = true;
|
||||||
|
|
Loading…
Reference in New Issue