OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 def GetHighlight(line, error): | 6 def GetHighlight(line, error): |
7 """Returns the substring of |line| that is highlighted in |error|.""" | 7 """Returns the substring of |line| that is highlighted in |error|.""" |
8 error_lines = error.split('\n') | 8 error_lines = error.split('\n') |
9 # TODO(dschuyler): delve into multi-line errors further. | |
Dan Beam
2016/06/25 00:49:03
what's the issue here exactly?
dschuyler
2016/06/28 19:04:18
Changed comment to better explain.
Done.
| |
10 if line not in error_lines: | |
11 return line | |
9 highlight = error_lines[error_lines.index(line) + 1] | 12 highlight = error_lines[error_lines.index(line) + 1] |
10 return ''.join(ch1 for (ch1, ch2) in zip(line, highlight) if ch2 == '^') | 13 return ''.join(ch1 for (ch1, ch2) in zip(line, highlight) if ch2 == '^') |
OLD | NEW |