Skip to main content

Module comments

Module comments 

Source
Expand description

Q1 — mapping a Google comment back to the org structural element it anchors to.

Pull (Q2) needs to file each reviewer comment under the right section of the org file. Google gives us two hints, in descending order of reliability:

  1. The comment anchor — an undocumented, brittle blob (D2; Google bug 292610078). When it happens to carry a recoverable start index, we look up the position map (crate::project::PositionMap) for the element whose projected start index is the largest at or below it, and report that element’s containing section (:CUSTOM_ID:).
  2. The quotedFileContent — the text the reviewer selected. When the anchor is unusable (empty, not JSON, or carrying no index we recognize), we fall back to locating the section whose projected text contains the quote (DI-5). This is the primary mechanism in practice: real kix anchors frequently carry no plain index, so the quote fallback is what usually resolves a comment.

When neither hint resolves, the comment is reported as document-level. The output is always a Location — a :CUSTOM_ID: or document-level, never a character offset (DI-5).

This module is pure and total (EI-4): the anchor parse is best-effort and never panics on a malformed blob (EI-2); it degrades to the fallback instead.

Structs§

Resolver
Resolves Google comments to org Locations for one document.

Enums§

Location
Where a reviewer comment anchors in the org file.