4

Is there any way to specify a span i.e. a triple of

(line, start-column, end-column)

for an error pattern? I'd like, for example, to be able to use flycheck to highlight an expression:

x + 1

and not just the identifier x? (Also posted as: https://github.com/flycheck/flycheck/issues/455)

Many thanks!

Ranjit Jhala
  • 1,242
  • 8
  • 18
  • 2
    As far as I know it is not supported but could be implemented. Modify the flycheck-error struct to support a `region` field. And fill it in when you create your error objects in the error parser. Then add a case to `flycheck-error-region-for-mode` for 'region and have it return the error's region field as a (beg . end) cell. Then make sure `flycheck-highlighting-mode` is set to 'region. – Jordon Biondo Aug 08 '14 at 19:45
  • 1
    I was able to implement this just now. I added "end" to the error struct. And inside `flycheck-error-column-region` I checked for the existence of "end", if it was there, returned the region from "column" to "end" on the error's line. The rest was handled by existing code. I had a checker that highlighted lines longer than 80 columns, and now it can actually highlight from 80 to the end of the line. – Jordon Biondo Aug 08 '14 at 20:39
  • Nice! Would it be possible for you to share your code? I'm, rather new to emacs-lisp. Thanks! – Ranjit Jhala Aug 08 '14 at 21:06

0 Answers0