I'm writing a pyflakes plugin (pychcker/lint type module) and I was thinking I would prefer to have the error lines highlighted, and display the error messages in the status bar for the line my cursor is in.

The only problem is, I can't see that there's any kind of way to accomplish this currently. The best idea I could come up with off the top of my head was a callback of this sort:

You can highlight the lines using the regions API - add a region representing the entire line. You'll likely want to use the DRAW_OUTLINED flag to not override the normal syntax highlighting. I'm planning to add support for adding icons in the gutter, but it's not there yet.

One option for adding line-specific status messages is to build a table of them in your plugin, and implement the onSelectionModified callback in your plugin, setting the status message if the selection is now on an interesting line.

Yes, I've already completed everything but the statusMessages in a similar manner...

I didn't realize that onSelectionModified would give me the updated cursor position even if i had nothing selected... Upon quickly testing it looks like it works perfect. I knew I must be missing something quite obvious

Thanks.

EDIT: maybe it wasn't that obvious, since I don't see onSelectionModified in the official docs. Next time I will check the beta change sets. What does it take to get commit access to the community plugins/wiki? I'd like to give the wiki a little love. (and upload my plugin when it's completed)

jps wrote:You can highlight the lines using the regions API - add a region representing the entire line. You'll likely want to use the DRAW_OUTLINED flag to not override the normal syntax highlighting. I'm planning to add support for adding icons in the gutter, but it's not there yet.

One option for adding line-specific status messages is to build a table of them in your plugin, and implement the onSelectionModified callback in your plugin, setting the status message if the selection is now on an interesting line.

Both the above APIs require the current beta.

For the most part this is working well, I'm trying to use setStatus() but it doesn't seem like there's a way to put my message _after_ the default 'Line X, Column Y' message.

(I also the tried .statusMessage() but that temporarily persists that message, so if I enter a line with an error and then move the cursor to a line without an error, it's still displaying the previous message.)

I could just append spaces to the end of my message to push the default one off, or just handle all the status messages, but this seems like a bad idea and would interfere with other plugin's messages.

It sounds like you should just use setStatus(), and not worry too much about the position of the 'Line X, Column Y' message.

You can clear the status message by calling sublime.statusMessage(''), but you'll want to be careful, and only clear it when going from a line with a status message to one without, otherwise you'll end up always overwriting what should be getting displayed with the status message, such as what the find panel prints.

jps wrote:It sounds like you should just use setStatus(), and not worry too much about the position of the 'Line X, Column Y' message.

You can clear the status message by calling sublime.statusMessage(''), but you'll want to be careful, and only clear it when going from a line with a status message to one without, otherwise you'll end up always overwriting what should be getting displayed with the status message, such as what the find panel prints.

That is in fact what I settled on, for now. It would be nice to have just a little more control over the order that default message gets placed in the statusbar (also be nice to be able to change the separator),

(maybe by making it subject to the regular status key ordering and allowing that key to be changed)

It's not so much that I personally can't stand that the message is no longer where it usually is, but that I think as much of the default behavior should be unaffected by a plugin I write. If that's where people usually look to see where they are in a file, they'll have to search to the arbitrary end of whatever message my plugin sticks in there. (I look there somewhat often to check my line lengths)

But, I can see it's obviously not something that people are clamoring for.

Also, in regard to the suggestion of sublime.statusMessage(''), clearing the status bar is just a matter of removing my part of the message: calling view.eraseStatus(mykey), sublime worries about the rest.