Handle windows linebreaks in getSourceFileImportLocation#19791
Conversation
| return position; | ||
|
|
||
| function AdvancePastLineBreak() { | ||
| if (text.charCodeAt(position) === 0xD) { |
There was a problem hiding this comment.
ts.characterCodes.carriageReturn over 0xD?
| position++; | ||
| } | ||
|
|
||
| if (text.charCodeAt(position) === 0xA) { |
There was a problem hiding this comment.
Same here, I think it's more clear if the character codes enum is used.
| return position; | ||
|
|
||
| function AdvancePastLineBreak() { | ||
| if (text.charCodeAt(position) === 0xD) { |
There was a problem hiding this comment.
CharacterCodes.carriageReturn
| position++; | ||
| } | ||
|
|
||
| if (text.charCodeAt(position) === 0xA) { |
There was a problem hiding this comment.
use isLineBreak to handle other line break characters like \u2028 ans 29
| } | ||
| return position; | ||
|
|
||
| function AdvancePastLineBreak() { |
There was a problem hiding this comment.
would skipTrivia be sufficient here?
There was a problem hiding this comment.
Wouldn't that skip other whitespace and comments?
There was a problem hiding this comment.
Though I am confused as to why this is upper camel case instead of lower camel case like every other helper function .
There was a problem hiding this comment.
That would be because I'm a C# dev. 😉
There was a problem hiding this comment.
but you are at the end of the line anyways.. so comments and white spaces are not an issue here..
There was a problem hiding this comment.
Good point. I notice, though, that skipTrivia doesn't handle the other linebreak characters. Unless you object, I'll leave it like this for the sake of explicitness.
No description provided.