Crate workspacer_register

Source

Structs§

ExistingXMacro
ExistingXMacroBuilder
Builder for ExistingXMacro.
TopBlockMacro
TopBlockMacroBuilder
Builder for TopBlockMacro.

Enums§

ExistingXMacroBuilderError
Error type for ExistingXMacroBuilder
TopBlockMacroBuilderError
Error type for TopBlockMacroBuilder

Traits§

EnsureAllSourceFilesAreRegistered

Functions§

assemble_final_top_block_snippet
Builds the final top-block snippet by combining:
build_top_block_for_imports_line
Builds the final snippet for the “has_imports_line=true” scenario: (a) old_top_macros first (with their leading comments), (b) then non-macro lines, (c) then new_top_macros.
build_top_block_for_no_imports_line
Builds the final snippet for the “has_imports_line=false” scenario: (a) snippet lines first, (b) then old_top_macros, (c) then new_top_macros.
collect_existing_mod_macro_stems
collect_existing_x_macros
create_top_block_text
Builds a string with one line per TopBlockMacro, preserving each macro’s leading comments and ensuring each macro ends up on its own line (with no trailing newline).
determine_top_block_insertion_offset
existing_macros_to_top_block_macros
extract_non_macro_lines
extract_stem
file_has_imports_line
filter_new_macros_for_duplicates
Removes from new_macros any macro whose stem is already in old_macros.
find_earliest_non_macro_item_offset
find_last_import_end_before_offset
find_top_block_insertion_offset
gather_deduplicated_macro_stems
gather_leading_comments
A helper that walks backward from item.syntax() to pick up line-comments, similarly to what we do for old macros. If no separate tokens are found, but the item’s own text starts with //, we parse those lines directly from full_text as a fallback.
gather_old_top_block_macros
is_imports_line
is_x_macro
make_top_block_macro_lines
maybe_ensure_newline
If there is content in buffer and it does not end with a newline, push exactly one \n.
maybe_push_newline
A small helper that ensures if the buffer is non-empty and doesn’t end with \n, we push exactly one newline.
parse_new_macros_with_comments
A version of parse_new_macros_with_comments that does NOT do fallback merging snippet lines into the macro.
parse_new_top_block_snippet
push_macro_with_comments
A small helper for pushing a TopBlockMacro (leading comments + x!{stem}), ensuring each part ends in exactly one \n if needed.
rebuild_librs_with_new_top_block
remove_trailing_newlines
Removes trailing newlines from the provided buffer string (in-place).
snap_offset_to_newline
Rounds an offset up to the next newline if it’s in the middle of a line, without exceeding earliest_offset.
splice_top_block_into_source
Rebuilds the final text by copying old_text except for old macros, and inserting the final_top_block at insertion_offset. This version ensures: