Repository navigation
Conversation
Reuse the exclusive end offset already calculated by rangeBy() when searching for a word in nodes from custom syntaxes. A line/column end position is inclusive and otherwise leaves out the last character. Extend the existing missing-offset tests with a word at the node end. Signed-off-by: Don Yin <Don_Yin@outlook.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
When a custom syntax provides only line/column positions, a
wordending at the node's last character is not found.positionBy()falls back to the node start, andrangeBy()makes errors and warnings point there too.For example, with
postcss-sass@0.5.0:The end line/column is inclusive, but
slice()needs an exclusive end. This reuses the end offset already normalized byrangeBy()for both word searches, without adding another conversion rule.The existing missing-offset tests now also check a word at the node end. Both fail before the change and pass afterward.
pnpm testpasses all 721 tests, coverage, lint, types, version, integration, and size checks.The measured columns for the example above: