-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(compiler): Incorrect focus on error [LNG-274] #959
Conversation
LNG-274 StringIndexOutOfBoundsException on correct code
throws
|
also fixes LNG-272 |
Co-authored-by: InversionSpaces <[email protected]>
): FocusedLine = | ||
val end = idx + len | ||
// if we want to point to the place after a string, pad this string with spaces | ||
val padded = | ||
if (str.length < idx + len) str.padTo(end, ' ') | ||
else str | ||
FocusedLine( | ||
padded.substring(0, idx), | ||
padded.substring(idx, end), | ||
padded.substring(end) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use String#slice
method?
Co-authored-by: InversionSpaces <[email protected]>
Co-authored-by: InversionSpaces <[email protected]>
str.substring(idx + len) | ||
) | ||
): FocusedLine = | ||
val end = idx + len |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could you wrap the method in {}
?
I don't like indentation as scope marking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
me too
Co-authored-by: InversionSpaces <[email protected]>
Co-authored-by: InversionSpaces <[email protected]>
Description
this code throws
StringOutOfBound
instead of parser errorProposed Changes
Pad strings that the compiler error renderer can point.
Checklist
Reviewer Checklist