Skip to content

Extract shared YAML-scan helper for scanner and editor#81

Merged
VPDPersonal merged 1 commit into
feature/serialize-reference-dropdownfrom
refactor/sr-shared-yaml-scan-helper
Jun 23, 2026
Merged

Extract shared YAML-scan helper for scanner and editor#81
VPDPersonal merged 1 commit into
feature/serialize-reference-dropdownfrom
refactor/sr-shared-yaml-scan-helper

Conversation

@VPDPersonal

Copy link
Copy Markdown
Owner

Summary

  • Extract the duplicated YAML-scan primitives shared by the graph scanner and the repair flow into one new internal static SerializeReferenceYaml helper: the --- !u!N &id document-header regex, the RefIds: block lookup, the inline class/ns/asm type grammar plus its TryParseInlineType, IndentOf and FindEntryEnd.
  • SerializeReferenceGraphScanner and SerializeReferenceYamlEditor now both call the shared primitives, so the graph window and the missing-reference repair flow can no longer silently disagree about Unity's RefIds shape (quoting, indentation, sentinel handling).

Notes for review

  • The shared IndentOf counts tabs as well as spaces (matching the editor's existing implementation and both readers' \s* indent regexes). The scanner's old copy counted spaces only; since Unity always emits space-indented YAML this is behavior-neutral on real assets and removes a latent inconsistency with the scanner's own regexes.
  • The shared DocumentHeader regex uses named groups (class/id); the editor's FindMissingReferences / FindDocumentRange were updated from Groups[1] to Groups["id"] to keep reading the file-id anchor (not the class id).
  • FindEntryEnd is unified on the headerIndex signature; the scanner's single call site was adjusted from passing i + 1 to i accordingly (same scanned range).
  • The editor keeps thin private forwarders (IndentOf/FindEntryEnd/FindRefIdsStart/TryParseInlineType) delegating to the shared helper, so its many internal call sites stay untouched while the implementation is single-sourced.

Linked issues

Refs #49 - addresses review finding #49 (comment)

@VPDPersonal VPDPersonal added type: refactor Internal restructuring without behavior change status: needs-review Ready for review area: editor Editor-only code labels Jun 21, 2026
@VPDPersonal VPDPersonal merged commit f359a55 into feature/serialize-reference-dropdown Jun 23, 2026
1 check passed
@VPDPersonal VPDPersonal deleted the refactor/sr-shared-yaml-scan-helper branch June 23, 2026 08:50
@github-actions github-actions Bot removed the status: needs-review Ready for review label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Editor-only code type: refactor Internal restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant