Repository navigation
Commit d5a2f29
committed
fix(core): keep spaces after a block comment on an import line
The type-only print copied a same-line import comment and the spaces
before it, and stopped at the end of the comment. A line comment's span
already includes the spaces after it. A block comment ends at `*/`, so
`import { a } from './a'; /* keep */ ` was printed without those
spaces.
TypeScript 5.9 and 6 still mapped the line, because the rest-of-line
check trims trailing spaces. TypeScript 7 grows a verbatim span only
over whitespace that is the same in both files, so it could not walk
from the generated newline across the source-only spaces. Organize
Imports, Sort Imports, and Remove Unused Imports then applied no edits.
The print now copies the spaces and tabs after the last block comment.
The rest of the line matches, and the import's span covers the newline
the edit runs to.1 parent cddec65 commit d5a2f29
3 files changed
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
| 165 | + | |
| 166 | + | |
164 | 167 | | |
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
171 | 178 | | |
172 | 179 | | |
173 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1922 | 1922 | | |
1923 | 1923 | | |
1924 | 1924 | | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
1925 | 1931 | | |
1926 | 1932 | | |
1927 | 1933 | | |
| |||
0 commit comments