Sublime Forum

Markup text ranges for warnings/hints?


During builds ST parses the “file_regex” pattern and displays “phantoms” in the document. Is there a way I could show some form of persistent markup like an underline for compiler warnings/hints? The phantoms are great for errors but I wanted something less intrusive for warning and hints.



That sort of thing can be done by using the view.add_regions() API. Given a list of file regions it can apply underlines, boxes, background fill or combinations of those in addition to adding icons to the gutter on the lines. That’s the API that things like SublimeLinter use in order to apply annotations to files, for example.

An example of that is linked below, which you can run from the Sublime console to get a feel for what it does.