highlighting for views; view doc / autocompletion coverage

This commit is contained in:
Ryan Fleury
2026-04-22 16:09:32 -07:00
parent 2eb0b8b233
commit 0d3539d707
8 changed files with 150 additions and 63 deletions
+4 -8
View File
@@ -207,7 +207,6 @@
#define MemoryCopy(dst, src, size) memmove((dst), (src), (size)) #define MemoryCopy(dst, src, size) memmove((dst), (src), (size))
#define MemorySet(dst, byte, size) memset((dst), (byte), (size)) #define MemorySet(dst, byte, size) memset((dst), (byte), (size))
#define MemoryCompare(a, b, size) memcmp((a), (b), (size)) #define MemoryCompare(a, b, size) memcmp((a), (b), (size))
#define MemoryStrlen(ptr) strlen(ptr)
#define MemoryCopyStruct(d,s) MemoryCopy((d),(s),sizeof(*(d))) #define MemoryCopyStruct(d,s) MemoryCopy((d),(s),sizeof(*(d)))
#define MemoryCopyArray(d,s) MemoryCopy((d),(s),sizeof(d)) #define MemoryCopyArray(d,s) MemoryCopy((d),(s),sizeof(d))
@@ -225,9 +224,6 @@
#define MemoryIsZeroStruct(ptr) memory_is_zero((ptr), sizeof(*(ptr))) #define MemoryIsZeroStruct(ptr) memory_is_zero((ptr), sizeof(*(ptr)))
#define MemoryRead(T,p,e) ( ((p)+sizeof(T)<=(e))?(*(T*)(p)):(0) )
#define MemoryConsume(T,p,e) ( ((p)+sizeof(T)<=(e))?((p)+=sizeof(T),*(T*)((p)-sizeof(T))):((p)=(e),0) )
//////////////////////////////// ////////////////////////////////
//~ rjf: Asserts //~ rjf: Asserts
@@ -502,29 +498,29 @@ union U512
typedef struct U16Array U16Array; typedef struct U16Array U16Array;
struct U16Array struct U16Array
{ {
U64 count;
U16 *v; U16 *v;
U64 count;
}; };
typedef struct U32Array U32Array; typedef struct U32Array U32Array;
struct U32Array struct U32Array
{ {
U64 count;
U32 *v; U32 *v;
U64 count;
}; };
typedef struct U64Array U64Array; typedef struct U64Array U64Array;
struct U64Array struct U64Array
{ {
U64 count;
U64 *v; U64 *v;
U64 count;
}; };
typedef struct U128Array U128Array; typedef struct U128Array U128Array;
struct U128Array struct U128Array
{ {
U64 count;
U128 *v; U128 *v;
U64 count;
}; };
//////////////////////////////// ////////////////////////////////
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -603,7 +603,7 @@ C_LINKAGE_BEGIN
extern String8 rd_tab_fast_path_view_name_table[25]; extern String8 rd_tab_fast_path_view_name_table[25];
extern String8 rd_tab_fast_path_query_name_table[25]; extern String8 rd_tab_fast_path_query_name_table[25];
extern RD_VocabInfo rd_vocab_info_table[360]; extern RD_VocabInfo rd_vocab_info_table[360];
extern RD_NameSchemaInfo rd_name_schema_info_table[26]; extern RD_NameSchemaInfo rd_name_schema_info_table[40];
extern String8 rd_reg_slot_code_name_table[49]; extern String8 rd_reg_slot_code_name_table[49];
extern Rng1U64 rd_reg_slot_range_table[49]; extern Rng1U64 rd_reg_slot_range_table[49];
extern String8 rd_binding_version_remap_old_name_table[8]; extern String8 rd_binding_version_remap_old_name_table[8];
+101 -36
View File
@@ -226,7 +226,7 @@ RD_VocabTable:
@table(name schema) RD_SchemaTable: @table(name schema) RD_SchemaTable:
{ {
//- rjf: users / projects //- rjf: @schema users
{ {
user, user,
``` ```
@@ -253,7 +253,7 @@ RD_VocabTable:
@description("The user's theme, which describes all colors used throughout the UI.") @description("The user's theme, which describes all colors used throughout the UI.")
'theme': string, 'theme': string,
@no_expand @display_name('User Theme') @no_expand @display_name('User Theme')
'theme_colors': query, 'theme_colors': set,
//- rjf: autocompletion //- rjf: autocompletion
@display_name('Autocompletion Lister') @description("Enables the autocompletion lister while typing expressions.") @default(1) @display_name('Autocompletion Lister') @description("Enables the autocompletion lister while typing expressions.") @default(1)
@@ -305,9 +305,12 @@ RD_VocabTable:
``` ```
} }
//- rjf: @schema project
//
// TODO(rjf): the control codes could be fed from the D_ExceptionCodeKindTable, but // TODO(rjf): the control codes could be fed from the D_ExceptionCodeKindTable, but
// we do not support that in this generator - we'd need a way to form a table-generated // we do not support that in this generator - we'd need a way to form a table-generated
// string and put it into a table cell... // string and put it into a table cell...
//
{ {
project project
``` ```
@@ -328,7 +331,7 @@ RD_VocabTable:
@default("None") @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.") @default("None") @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.")
'theme': string, 'theme': string,
@no_expand @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.") @no_expand @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.")
'theme_colors': query, 'theme_colors': set,
//- rjf: exception settings //- rjf: exception settings
@default(1) @display_name("Break On Win32 Control-C Exceptions") @description("Code: 0x40010005") @default(1) @display_name("Break On Win32 Control-C Exceptions") @description("Code: 0x40010005")
@@ -409,7 +412,7 @@ RD_VocabTable:
``` ```
} }
//- rjf: theme colors //- rjf: @schema theme_color
{ {
theme_color, theme_color,
``` ```
@@ -423,7 +426,7 @@ RD_VocabTable:
``` ```
} }
//- rjf: windows //- rjf: @schema window
{ {
window, window,
``` ```
@@ -454,7 +457,7 @@ RD_VocabTable:
``` ```
} }
//- rjf: tabs //- rjf: @schema tab
{ {
tab, tab,
``` ```
@@ -467,21 +470,49 @@ RD_VocabTable:
``` ```
} }
//- rjf: views //- rjf: @schema bin
{ {bin ```x:{ @description('An expression to which the 2-radix display should apply.') 'expression': expr_string }```}
watch,
``` //- rjf: @schema oct
@inherit(tab) x: {oct ```x:{ @description('An expression to which the 8-radix display should apply.') 'expression': expr_string }```}
{
@override @display_name('Tab Row Height') @description("Controls the tab's row height, in multiples of the font size.") //- rjf: @schema hex
'row_height': @range[1.75f, 5.f] f32, {hex ```x:{ @description('An expression to which the 16-radix display should apply.') 'expression': expr_string }```}
'label': code_string,
@description("The root expression which is evaluated to produce the watch window.") //- rjf: @schema digits
'expression': expr_string, {digits ```x:{ @description('An expression to which the digit display should apply.') 'expression': expr_string, @description('The minimum number of digits to display.') 'digit_count': u64 }```}
@no_expand 'watches': query,
} //- rjf: @schema no_string
``` {no_string ```x:{ @description('The expression for which string visualization should be disabled.') 'expression': expr_string}```}
}
//- rjf: @schema no_char
{no_char ```x:{ @description('The expression for which character visualization should be disabled.') 'expression': expr_string}```}
//- rjf: @schema no_addr
{no_addr ```x:{ @description('The expression for which address visualization should be disabled.') 'expression': expr_string}```}
//- rjf: @schema sequence
{sequence ```x:{ @description('The number of expansions to generate.') 'count': expr_string}```}
//- rjf: @schema rows
{rows ```x:{ @description('The expression for which rows should be generated.') 'expression': expr_string, @description('A list of expressions which will be used to generate rows.') '...'}```}
//- rjf: @schema columns
{columns ```x:{ @description('The expression for whose expansions columns should be generated.') 'expression': expr_string, @description('A list of expressions which will be used to generate columns for each expansion from `expression`.') '...'}```}
//- rjf: @schema omit
{omit ```x:{ @description('The expression for which certain members should be omitted.') 'expression': expr_string, @description('A list of member names to omit from the expansion.') '...'}```}
//- rjf: @schema range1
{range1 ```x:{ @description('The expression which should be bounded by `min` and `max`.') 'expression': expr_string, @description('The lower bound.') min, @description('The upper bound.') max}```}
//- rjf: @schema array
{array ```x:{ @description('An expression of the base address of the array.') 'base_address': expr_string, @description('The number of elements in the array.') count}```}
//- rjf: @schema slice
{slice ```x:{ @description('An expression of a structure that is to be interpreted as a slice.') 'expression': expr_string}```}
//- rjf: @schema list
{ {
list, list,
``` ```
@@ -494,6 +525,24 @@ RD_VocabTable:
} }
``` ```
} }
//- rjf: @schema watch
{
watch,
```
@inherit(tab) x:
{
@override @display_name('Tab Row Height') @description("Controls the tab's row height, in multiples of the font size.")
'row_height': @range[1.75f, 5.f] f32,
'label': code_string,
@description("The root expression which is evaluated to produce the watch window.")
'expression': expr_string,
@no_expand 'watches': set,
}
```
}
//- rjf: @schema text
{ {
text, text,
``` ```
@@ -514,6 +563,8 @@ RD_VocabTable:
} }
``` ```
} }
//- rjf: @schema disasm
{ {
disasm, disasm,
``` ```
@@ -537,6 +588,8 @@ RD_VocabTable:
} }
``` ```
} }
//- rjf: @schema memory
{ {
memory, memory,
``` ```
@@ -567,10 +620,12 @@ RD_VocabTable:
@default(1) @display_name("Peek As Signed") 'peek_as_signed': bool, @default(1) @display_name("Peek As Signed") 'peek_as_signed': bool,
@default(1) @display_name("Peek As Float") 'peek_as_float': bool, @default(1) @display_name("Peek As Float") 'peek_as_float': bool,
@display_name("Extra Peek Types") @description("A list of types as which to interpret selected memory.") @display_name("Extra Peek Types") @description("A list of types as which to interpret selected memory.")
'peek_types': query, 'peek_types': set,
} }
``` ```
} }
//- rjf: @schema bitmap
{ {
bitmap, bitmap,
``` ```
@@ -585,6 +640,8 @@ RD_VocabTable:
} }
``` ```
} }
//- rjf: @schema color
{ {
color, color,
``` ```
@@ -595,6 +652,8 @@ RD_VocabTable:
} }
``` ```
} }
//- rjf: @schema geo3d
{ {
geo3d, geo3d,
``` ```
@@ -612,7 +671,7 @@ RD_VocabTable:
``` ```
} }
//- rjf: getting started //- rjf: @schema getting_started
{ {
getting_started, getting_started,
``` ```
@@ -622,7 +681,7 @@ RD_VocabTable:
``` ```
} }
//- rjf: targets //- rjf: @schema target
{ {
target, target,
``` ```
@@ -638,14 +697,14 @@ RD_VocabTable:
'stdout_path': @no_relativize path, 'stdout_path': @no_relativize path,
'stderr_path': @no_relativize path, 'stderr_path': @no_relativize path,
'stdin_path': @no_relativize path, 'stdin_path': @no_relativize path,
'environment': query, 'environment': set,
'debug_subprocesses': bool, 'debug_subprocesses': bool,
@no_revert @no_expand @default(0) 'enabled': bool, @no_revert @no_expand @default(0) 'enabled': bool,
} }
```, ```,
} }
//- rjf: breakpoints //- rjf: @schema breakpoint
{ {
breakpoint, breakpoint,
``` ```
@@ -667,7 +726,7 @@ RD_VocabTable:
```, ```,
} }
//- rjf: watch pins //- rjf: @schema watch_pin
{ {
watch_pin, watch_pin,
``` ```
@@ -682,7 +741,7 @@ RD_VocabTable:
```, ```,
} }
//- rjf: debug infos //- rjf: @schema debug_info
{ {
debug_info, debug_info,
``` ```
@@ -697,46 +756,52 @@ RD_VocabTable:
```, ```,
} }
//- rjf: file path maps //- rjf: @schema file_path_map
{ {
file_path_map, file_path_map,
```@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @no_relativize path, 'dest': @no_relativize path}```, ```@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @no_relativize path, 'dest': @no_relativize path}```,
} }
//- rjf: type views //- rjf: @schema type_view
{ {
type_view, type_view,
```@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}```, ```@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}```,
} }
//- rjf: recent projects //- rjf: @schema recent_project
{ {
recent_project, recent_project,
```x:{'path':path}```, ```x:{'path':path}```,
} }
//- rjf: recent files //- rjf: @schema recent_file
{ {
recent_file, recent_file,
```x:{'path':path}```, ```x:{'path':path}```,
} }
//- rjf: control entities //- rjf: @schema machine
{ {
machine, machine,
```x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':query, 'processes':query}```, ```x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':set, 'processes':set}```,
} }
//- rjf: @schema process
{ {
process, process,
```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'modules':query, 'threads':query}```, ```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'modules':set, 'threads':set}```,
} }
//- rjf: @schema module
{ {
module, module,
```x:{'exe':path, 'dbg':path, 'vaddr_range':vaddr_range}```, ```x:{'exe':path, 'dbg':path, 'vaddr_range':vaddr_range}```,
} }
//- rjf: @schema thread
{ {
thread, thread,
```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'call_stack':query}```, ```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'call_stack':set}```,
} }
} }
+16 -5
View File
@@ -6014,7 +6014,7 @@ rd_window_frame(void)
UI_TagF("weak") ui_label(display_name); UI_TagF("weak") ui_label(display_name);
} }
} }
UI_TagF("weak") ui_label(desc); UI_TagF("weak") rd_label(desc);
} }
} }
} }
@@ -9345,7 +9345,7 @@ rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs)
MD_Node *arg_schema = &md_nil_node; MD_Node *arg_schema = &md_nil_node;
if(callee_expr.size != 0) if(callee_expr.size != 0)
{ {
E_Eval callee_eval = e_eval_from_string(callee_expr); E_Eval callee_eval = e_eval_from_stringf("view:%S", callee_expr);
E_Type *callee_type = e_type_from_key(callee_eval.irtree.type_key); E_Type *callee_type = e_type_from_key(callee_eval.irtree.type_key);
if(callee_type->kind == E_TypeKind_LensSpec) if(callee_type->kind == E_TypeKind_LensSpec)
{ {
@@ -9375,7 +9375,7 @@ rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs)
cursor_info.list_expr = push_str8_copy(ws->autocomp_arena, list_expr); cursor_info.list_expr = push_str8_copy(ws->autocomp_arena, list_expr);
cursor_info.filter = push_str8_copy(ws->autocomp_arena, filter); cursor_info.filter = push_str8_copy(ws->autocomp_arena, filter);
cursor_info.replaced_range = replaced_range; cursor_info.replaced_range = replaced_range;
cursor_info.callee_expr = push_str8_copy(ws->autocomp_arena, callee_expr); cursor_info.callee_expr = str8f(ws->autocomp_arena, "view:%S", callee_expr);
cursor_info.arg_schema = arg_schema; cursor_info.arg_schema = arg_schema;
scratch_end(scratch); scratch_end(scratch);
@@ -9454,7 +9454,7 @@ rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind)
} }
internal RD_CodeColorSlot internal RD_CodeColorSlot
rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string) rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string, B32 allow_macros, B32 is_called)
{ {
RD_CodeColorSlot color = RD_CodeColorSlot_CodeDefault; RD_CodeColorSlot color = RD_CodeColorSlot_CodeDefault;
if(kind == TXT_TokenKind_Identifier || kind == TXT_TokenKind_Keyword) if(kind == TXT_TokenKind_Identifier || kind == TXT_TokenKind_Keyword)
@@ -9505,6 +9505,17 @@ rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8
} }
} }
// rjf: try to map as macro
if((!mapped || is_called) && allow_macros)
{
E_Expr *expr = e_string2expr_map_lookup(e_ir_ctx->macro_map, string);
if(expr != &e_expr_nil)
{
mapped = 1;
color = RD_CodeColorSlot_CodeMeta;
}
}
// rjf: try to map using asynchronous matching system // rjf: try to map using asynchronous matching system
if(!mapped && kind == TXT_TokenKind_Identifier) if(!mapped && kind == TXT_TokenKind_Identifier)
{ {
@@ -11615,7 +11626,7 @@ rd_frame(void)
} }
//- rjf: add types for queries //- rjf: add types for sets
{ {
e_string2typekey_map_insert(rd_frame_arena(), rd_state->meta_name2type_map, str8_lit("environment"), e_string2typekey_map_insert(rd_frame_arena(), rd_state->meta_name2type_map, str8_lit("environment"),
e_type_key_cons(.kind = E_TypeKind_Set, e_type_key_cons(.kind = E_TypeKind_Set,
+1 -1
View File
@@ -755,7 +755,7 @@ internal void rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs);
internal MD_Node *rd_theme_tree_from_name(Arena *arena, Access *access, String8 theme_name); internal MD_Node *rd_theme_tree_from_name(Arena *arena, Access *access, String8 theme_name);
internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot); internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot);
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind); internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind);
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string); internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string, B32 allow_macros, B32 is_called);
//- rjf: fonts //- rjf: fonts
internal F32 rd_font_size(void); internal F32 rd_font_size(void);
+1 -1
View File
@@ -361,7 +361,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema)
child_type_key = e_type_key_cons(.kind = E_TypeKind_Struct, .name = str8_lit("vaddr_range"), .count = vaddr_range_members.count, .members = vaddr_range_members.v); child_type_key = e_type_key_cons(.kind = E_TypeKind_Struct, .name = str8_lit("vaddr_range"), .count = vaddr_range_members.count, .members = vaddr_range_members.v);
scratch_end(scratch); scratch_end(scratch);
} }
else if(str8_match(child_schema->first->string, str8_lit("query"), 0)) else if(str8_match(child_schema->first->string, str8_lit("set"), 0))
{ {
child_type_key = e_string2typekey_map_lookup(rd_state->meta_name2type_map, child_schema->string); child_type_key = e_string2typekey_map_lookup(rd_state->meta_name2type_map, child_schema->string);
} }
+3 -2
View File
@@ -2347,7 +2347,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: token -> token color // rjf: token -> token color
RD_CodeColorSlot token_color_slot = rd_code_color_slot_from_txt_token_kind(token->kind); RD_CodeColorSlot token_color_slot = rd_code_color_slot_from_txt_token_kind(token->kind);
RD_CodeColorSlot lookup_color_slot = preceded_by_dot ? token_color_slot : rd_code_color_slot_from_txt_token_kind_lookup_string(token->kind, token_string); RD_CodeColorSlot lookup_color_slot = preceded_by_dot ? token_color_slot : rd_code_color_slot_from_txt_token_kind_lookup_string(token->kind, token_string, 0, 0);
Vec4F32 token_color = rd_rgba_from_code_color_slot(token_color_slot); Vec4F32 token_color = rd_rgba_from_code_color_slot(token_color_slot);
if(lookup_color_slot != RD_CodeColorSlot_CodeDefault) if(lookup_color_slot != RD_CodeColorSlot_CodeDefault)
{ {
@@ -3224,9 +3224,10 @@ rd_fstrs_from_code_string(Arena *arena, F32 alpha, B32 indirection_size_change,
case TXT_TokenKind_Keyword: case TXT_TokenKind_Keyword:
{ {
RD_CodeColorSlot lookup_theme_color_slot = RD_CodeColorSlot_CodeDefault; RD_CodeColorSlot lookup_theme_color_slot = RD_CodeColorSlot_CodeDefault;
B32 is_called = (token+1 < tokens_opl && token[1].kind == TXT_TokenKind_Symbol && str8_match(str8_substr(string, token[1].range), str8_lit("("), 0));
if(!preceded_by_dot) if(!preceded_by_dot)
{ {
lookup_theme_color_slot = rd_code_color_slot_from_txt_token_kind_lookup_string(token->kind, token_string); lookup_theme_color_slot = rd_code_color_slot_from_txt_token_kind_lookup_string(token->kind, token_string, 1, is_called);
} }
if(lookup_theme_color_slot != RD_CodeColorSlot_CodeDefault) if(lookup_theme_color_slot != RD_CodeColorSlot_CodeDefault)
{ {