[txmt-dev] Re: Setting the background color of a specific line
Allan Odgaard
mailinglist at textmate.org
Tue Apr 1 15:47:12 UTC 2014
On 1 Apr 2014, at 21:53, Gerd Knops wrote:
> I think a better approach for that would be if you could inject scopes
> into the document (like set error scope on line 54, char 12). Then you
> can use styles as usual to highlight the errors. Obviously it would
> also be necessary to be able to attach metadata to those warning/error
> scopes […]
My thoughts on such feature is to place warning and error images in the
gutter and allow mate as the interface:
"$TM_MATE" --line 32:3 --error "unexpected identifier"
/path/to/file
This should also make it feel natural to use F2/⇧F2 for next/previous
error/warning, as they would effectively be bookmarks with another icon
and possibly tool tip or some other way to render the additional text.
As TextMate::Executor.run’s default error matching code is used by
several bundles, it should be simple to have it call "$TM_MATE" and
thereby add this feature to several existing build/run commands.
There is partial support for the above already, see
https://github.com/textmate/textmate/blob/master/Frameworks/document/src/document.h#L88
— though extending ‘mate’ to allow setting marks is missing, so
are icons for other than “search” and “bookmark”, see
https://github.com/textmate/textmate/blob/master/Frameworks/OakTextView/src/OakDocumentView.mm#L698
As for the original question “I'm having trouble to get out the line_t
which matches a given line number. How can I do that?
”. You’re not really supposed to work with line_t objects outside of
the layout framework. You can query the layout to get coordinates for
buffer offsets, but if you want to change rendering, then it should
probably be added directly to layout_t (with an API that is then used by
OakTextView).
More information about the textmate-dev
mailing list