On 2014-04-01 17:47, Allan Odgaard wrote:
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
I like this approach much better.
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.
Yeah, I was thinking of placing the additional text on the same line but to the right edge, where there's usually some space.
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.
That's a good idea.
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
Ok, cool, I'll have a look.
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).
That's basically what I've already done. I added a method to OakTextView for setting error messages for a given line. This would then, via some other method calls, set error messages for a line_t object. I have then modified "draw_background" in line_t to render a background color when there are error messages present.
My original problem still remains, I haven't been able to figure out how to get the line_t object that matches a given line number, to set the error messages.
I've added a method to layout_t where I'm trying to get the row/paragraph_t which contains the line I'm interested in. I've used the same code as "layout_t::line_record_for" [1] to get a row, but as soon as I access the row I get a segmentation fault.
Hmm, the problem might also be in paragraph_t when I'm trying to find the node which matches the line I'm interested in. Currently I'm using "iterator_at", but that's probably not right.
[1] https://github.com/textmate/textmate/blob/master/Frameworks/layout/src/layout.cc#L400-L403
-- /Jacob Carlborg _______________________________________________ textmate-dev mailing list [email protected] http://lists.macromates.com/listinfo/textmate-dev
