Fixed an error formatting issue f7b36054fc
When using tab for code indent, the error marker will be wrongly positioned.
This commit is contained in:
parent
f7b36054fc
commit
3465e7554d
|
@ -220,7 +220,7 @@
|
|||
codeLine = this.code.split('\n')[first_line];
|
||||
start = first_column;
|
||||
end = first_line === last_line ? last_column + 1 : codeLine.length;
|
||||
marker = repeat(' ', start) + repeat('^', end - start);
|
||||
marker = codeLine.slice(0, start).replace(/[^\s]/g, ' ') + repeat('^', end - start);
|
||||
if (typeof process !== "undefined" && process !== null) {
|
||||
colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS;
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ syntaxErrorToString = ->
|
|||
start = first_column
|
||||
# Show only the first line on multi-line errors.
|
||||
end = if first_line is last_line then last_column + 1 else codeLine.length
|
||||
marker = repeat(' ', start) + repeat('^', end - start)
|
||||
marker = codeLine[...start].replace(/[^\s]/g, ' ') + repeat('^', end - start)
|
||||
|
||||
# Check to see if we're running on a color-enabled TTY.
|
||||
if process?
|
||||
|
|
Loading…
Reference in New Issue