Compare commits
No commits in common. "504d902dddc7e70307dc2a4c25e3990f6fa847d2" and "1507f414b1efb4029740854a5bf26ef4ed4bf1ee" have entirely different histories.
504d902ddd
...
1507f414b1
|
@ -208,6 +208,20 @@ code_index_unlock(void){
|
|||
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
|
||||
code_index__clear_file(Code_Index_File *file){
|
||||
for (Code_Index_Note *node = file->note_list.first;
|
||||
|
@ -235,6 +249,8 @@ code_index_set_file(Buffer_ID buffer, Arena arena, Code_Index_File *index){
|
|||
}
|
||||
storage->arena = arena;
|
||||
storage->file = index;
|
||||
|
||||
code_index__hash_file(index);
|
||||
}
|
||||
|
||||
function void
|
||||
|
@ -371,6 +387,8 @@ code_index_shift_list(Code_Index_Note_List *list, Range_i64 old_range, u64 new_s
|
|||
function void
|
||||
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->note_list, old_range, new_size);
|
||||
}
|
||||
|
|
|
@ -35,8 +35,9 @@ BUFFER_HOOK_SIG(custom_begin_buffer){
|
|||
|
||||
if (treat_as_code)
|
||||
{
|
||||
Async_Task* parse_task_ptr = scope_attachment(app, scope, buffer_parse_task, Async_Task);
|
||||
*parse_task_ptr = async_task_no_dep(&global_async_system, tree_sitter_parse_full_file_async, make_data_struct(&buffer_id));
|
||||
// TODO(PS): @AsyncrifyThis???
|
||||
tree_sitter_parse_incremental(app, 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);
|
||||
|
|
|
@ -325,10 +325,6 @@ tree_sitter_parse_full_file_async(Async_Context* actx, String_Const_u8 data)
|
|||
ts_tree_delete(old_buffer_tree);
|
||||
}
|
||||
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
|
||||
|
@ -783,16 +779,6 @@ tree_sitter_code_index_update_tick(Application_Links* app)
|
|||
ProfileScope(app, "Incremental Parse");
|
||||
Buffer_ID buffer_id = modified_node->buffer;
|
||||
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);
|
||||
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;
|
||||
|
||||
CUSTOM_ID(attachment, buffer_tree_sitter_data_id);
|
||||
CUSTOM_ID(attachment, buffer_parse_task);
|
||||
CUSTOM_ID(attachment, buffer_update_code_index_task);
|
||||
CUSTOM_ID(attachment, buffer_tree_sitter_parse_task_id);
|
||||
CUSTOM_ID(attachment, buffer_tree_sitter_update_code_index_task_id);
|
||||
|
||||
b8 use_tree_sitter_code_indexing = true;
|
||||
b8 use_tree_sitter_token_coloring = true;
|
||||
|
|
Loading…
Reference in New Issue