You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error location annotations don't line up when _hs source uses tabs for indentation #640
hyperscript's error annotations (the ^^ markers) do not line up with the printed source when it uses tab characters as indentation:
When spaces are used in the source, the marker lines up correctly:
This issue is because, when the annotation creator (createParserContext) is figuring out where to place the marker, it counts tab characters as a single character. If, on the first example, the tab characters are replaces with single spaces, the marker lines up correctly:
To solve this, either:
Around createParserContext's call to String.repeat, tabs would be specially-cased for the offset to count as some number of characters (4, 8, ...) rather than just one.
Or, the whitespace before the true start of a line could be copied, where the marker offset will only counted from the "real" start of the line (iow, where the indentation ends), and afterwards the saved whitespace is prepended to the " ".repeat(offset), something like
This is of course a bit hacky and doesn't take into account things like tabs in the middle of a line (which solution no.1 would do correctly, and only that among other edge cases I'm not smart enough to think of), but it works fine!
Activity
MichaelWest22 commentedon Aug 25, 2025
helpimnotdrowning commentedon Aug 26, 2025
that's what I get for staying up too late, this seems like a much nicer solution! (though maybe use 4 spaces per tab like how it's usually used)