Skip to content

Commit 2f13222

Browse files
committed
Handle windows linebreaks in getSourceFileImportLocation
1 parent d6436f1 commit 2f13222

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/services/utilities.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,18 +1335,30 @@ namespace ts {
13351335
let position = 0;
13361336
// However we should still skip a pinned comment at the top
13371337
if (ranges.length && ranges[0].kind === SyntaxKind.MultiLineCommentTrivia && isPinnedComment(text, ranges[0])) {
1338-
position = ranges[0].end + 1;
1338+
position = ranges[0].end;
1339+
AdvancePastLineBreak();
13391340
ranges = ranges.slice(1);
13401341
}
13411342
// As well as any triple slash references
13421343
for (const range of ranges) {
13431344
if (range.kind === SyntaxKind.SingleLineCommentTrivia && isRecognizedTripleSlashComment(node.text, range.pos, range.end)) {
1344-
position = range.end + 1;
1345+
position = range.end;
1346+
AdvancePastLineBreak();
13451347
continue;
13461348
}
13471349
break;
13481350
}
13491351
return position;
1352+
1353+
function AdvancePastLineBreak() {
1354+
if (text.charCodeAt(position) === 0xD) {
1355+
position++;
1356+
}
1357+
1358+
if (text.charCodeAt(position) === 0xA) {
1359+
position++;
1360+
}
1361+
}
13501362
}
13511363

13521364
/**

0 commit comments

Comments
 (0)