always prefer explicitly attached tags (view rules); give all tags a chance in sequence; allow 'default' to be explicitly attached, to disable auto-view-rules etc.

This commit is contained in:
Ryan Fleury
2025-02-20 16:38:27 -08:00
parent ec782fa39c
commit 428a3f2536
6 changed files with 28 additions and 25 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[12] =
{str8_lit_comp("breakpoint"), str8_lit_comp("@commands(enable_cfg, remove_cfg)\n@collection_commands(add_breakpoint, add_address_breakpoint, add_function_breakpoint)\nx:\n{\n 'label': code_string,\n 'condition': code_string,\n 'location': location,\n 'hit_count': u64,\n 'disabled': bool,\n}\n")},
{str8_lit_comp("watch_pin"), str8_lit_comp("@commands(remove_cfg)\n@collection_commands(add_watch_pin)\nx:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'location': location,\n}\n")},
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @commands(remove_cfg) x:{'source':path, 'dest':path}")},
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'source':code_string, 'dest':code_string}")},
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}")},
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},
{str8_lit_comp("recent_file"), str8_lit_comp("x:{'path':path}")},
{str8_lit_comp("machine"), str8_lit_comp("x:{'label':code_string, 'frozen':bool, 'unattached_processes':query, 'processes':query}")},
+1 -1
View File
@@ -213,7 +213,7 @@ RD_VocabTable:
//- rjf: auto view rules
{
auto_view_rule,
```@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'source':code_string, 'dest':code_string}```,
```@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}```,
}
//- rjf: recent projects
+2 -2
View File
@@ -11527,8 +11527,8 @@ rd_frame(void)
for(RD_CfgNode *n = auto_view_rules.first; n != 0; n = n->next)
{
RD_Cfg *rule = n->v;
String8 type_string = rd_cfg_child_from_string(rule, str8_lit("source"))->first->string;
String8 view_rule_string = rd_cfg_child_from_string(rule, str8_lit("dest"))->first->string;
String8 type_string = rd_cfg_child_from_string(rule, str8_lit("type"))->first->string;
String8 view_rule_string = rd_cfg_child_from_string(rule, str8_lit("view_rule"))->first->string;
e_auto_hook_map_insert_new(scratch.arena, ctx->auto_hook_map, .type_pattern = type_string, .tag_expr_string = view_rule_string);
}
}
+4 -4
View File
@@ -301,8 +301,8 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg)
//- rjf: special case: auto view rule
if(str8_match(cfg->string, str8_lit("auto_view_rule"), 0))
{
String8 src_string = rd_cfg_child_from_string(cfg, str8_lit("source"))->first->string;
String8 dst_string = rd_cfg_child_from_string(cfg, str8_lit("dest"))->first->string;
String8 src_string = rd_cfg_child_from_string(cfg, str8_lit("type"))->first->string;
String8 dst_string = rd_cfg_child_from_string(cfg, str8_lit("view_rule"))->first->string;
Vec4F32 src_color = rgba;
Vec4F32 dst_color = rgba;
DR_FStrList src_fstrs = {0};
@@ -328,9 +328,9 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg)
dst_fstrs = rd_fstrs_from_code_string(arena, 1.f, 0, dst_color, dst_string);
}
dr_fstrs_concat_in_place(&result, &src_fstrs);
dr_fstrs_push_new(arena, &result, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &result, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &result, &params, rd_icon_kind_text_table[RD_IconKind_RightArrow], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = rgba_secondary);
dr_fstrs_push_new(arena, &result, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &result, &params, str8_lit(" "));
dr_fstrs_concat_in_place(&result, &dst_fstrs);
}