[txmt-dev] Re: Implementing inline marks

Gerd Knops gerti-textmate at bitart.com
Thu May 29 13:30:21 UTC 2014


Hi Jacob,

This sounds like cool work! I can't comment on the questions you raise. But please be sure to make that system flexible enough to also support a column. Many languages provide columnar information along with the error.

In fact some languages even support a range and 1 or more "fix it" suggestions. It would be cool to be able to support that in Xcode.

Thanks

Gerd

On May 29, 2014, at 7:30 AM, Jacob Carlborg <doob at me.com> wrote:

> This is a followup on the "Setting the background color of a specific line" [1] thread. As I said later in that thread I'm now working on implementing inline marks (errors, warnings, etc). The way I imagined this to work like is how it works in Xcode. The "mate" command will have a flag to set a mark and data (text string) on a particular line (as discussed in the thread [1]). This will be shown in TextMate by it drawing a background color on all lines with a mark and the mark's data will be drawn on the same line but to the right (where there's usually extra space).
> 
> I have changed the implementation of drawing a background color on a line to use marks related functions [2] in the buffer framework as suggested in the previously mentioned thread. The next step is I need to support displaying marks data (error messages). For that I have two questions:
> 
> 1. I need to store the data (text) somewhere. Should I extend the "marks_t" [3] type to support storing some additional data or create a new separate type that behave like "marks_t"?
> 
> Actually, I've already tried and changed the implementation to store a std::vector<std::string> in the indexed map [4] instead of a std::string. The existing API in "marks_t" is complete backwards compatible and I've added new functions to return a std::vector<std::string> instead of a std::string. It works, but I don't know if it's a good idea.
> 
> 2. When it comes to drawing the marks data I think there's two options:
> 
> A. Add the data as a text node
> B. Draw it separately on a line
> 
> With A I don't know how well it works to basically have two separate text strings on the same line. One that will be draw from the left side (the code) and one that will be drawn from the right side (the mark data).
> 
> With B there's the issue with line wrapping. Usually there's plenty of space to the right of the text on a single line, because most developers try to keep their code within 80 columns (or similar). But if the main view gets too small, either by the window getting too small (or the output window is place inside the main window to the right) the mark data need to be able to wrap to not cover up the code in the main view.
> 
> I have already implemented option B with support for wrapping, but only for the same line, i.e. if the mark data would cover the code on the line which the mark is attached to, it will be rendered on the next line. But with the current implementation it will still cover code on the next line (if there is any). I'm wondering if I'm reimplementing some of TextMate's line wrapping by choosing option B.
> 
> [1] http://textmate.1073791.n5.nabble.com/txmt-dev-Setting-the-background-color-of-a-specific-line-td27632.html
> 
> [2] https://github.com/textmate/textmate/blob/master/Frameworks/buffer/src/buffer.h#L130-L136
> 
> [3] https://github.com/textmate/textmate/blob/master/Frameworks/buffer/src/meta_data.h#L38
> 
> [4] https://github.com/textmate/textmate/blob/master/Frameworks/buffer/src/meta_data.h#L53
> 
> -- 
> /Jacob Carlborg
> 
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate-dev



More information about the textmate-dev mailing list