Commit 7364284
fix: make retrieve inter-clause whitespace robust to indent changes
Replaces the hard-coded "\n " / "\r\n " suffix matches with a
backwards walk that strips a trailing newline plus whatever indent
(spaces or tabs) follows it. The formatter re-emits its own indent
before each clause, so the original source's trailing newline+indent
is structural and would duplicate after a roundtrip — but the old
4-space match silently dropped the entire whitespace gap if the
formatter or the source used a different width. Adds a doc comment
explaining the contract.
Also documents the `not(` heuristic in shouldPreserveExpressionSource
so future readers know it preserves the compact form against the
parser's `not (<expr>)` re-emission.
Addresses ako's review on PR #323.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 9aa2248 commit 7364284
1 file changed
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
1081 | 1092 | | |
1082 | 1093 | | |
1083 | 1094 | | |
1084 | 1095 | | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1088 | 1111 | | |
| 1112 | + | |
1089 | 1113 | | |
1090 | 1114 | | |
1091 | 1115 | | |
| |||
1263 | 1287 | | |
1264 | 1288 | | |
1265 | 1289 | | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
1266 | 1297 | | |
1267 | 1298 | | |
1268 | 1299 | | |
| |||
0 commit comments