fix(grammar): keep code out of the grammar checker #828
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-learn!828
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/828/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A code block's source lives in the node's own
delta— the same key aparagraph uses, deliberately, because that is the schema the learning-path
importer writes. Segmentation walked it like any other text-bearing node, so
every fenced listing in a card or a note was posted to LanguageTool as prose
and came back covered in squiggles: an identifier is a spelling error, a
statement is a sentence without a verb, and
}is missing punctuation. Inlinecode had the same problem in miniature — a run marked as code is still text in
the paragraph around it, so
setState()mid-sentence read as a typo.Both are now excluded, by the two mechanisms the feature already had for
inline math.
A
codenode is skipped outright, subtree and all, and yields no segment —nothing about it reaches the server. Inline-code runs are masked to
same-length spaces and recorded in
GrammarSegment.maskedRanges, which thecontroller already consults to drop any match touching a mask. Masking rather
than deleting is what preserves the invariant the overlay rests on: a
LanguageTool offset indexes the node's text 1:1, so it maps onto a
Positionwithout remapping. A paragraph that is only a snippet now yields no segment at
all, like a paragraph that is only a formula.
The truthiness test the math path used privately is now shared as
_isSet.AppFlowy writes
code: falsewhen a mark is toggled off rather than droppingthe key, so a bare null-check would have masked text the author had explicitly
un-marked.
Only the explicit mark is exempt. A bare
setState()typed into a plain runis still prose as far as the checker is concerned, and still checked — the
signal being honoured here is the author's, not a guess about what looks like
code.
Signed-off-by: Tizian 「ティツィアーン」 raisondetredev@pm.me