robcowie / SublimeTODO

**[DEPRECATED]** - See https://github.com/jonathandelgado/SublimeTodoReview - Extract TODO-type comments from open files and project folders
295 stars 54 forks source link

Should be able to click on result to go to file #9

Closed OscarGodson closed 12 years ago

OscarGodson commented 12 years ago

Like search, you should be able to click on the result to jump to that file and line

robcowie commented 12 years ago

I'm looking into it but right now. Unfortunately sublime-mousmap doesn't yet support context in bindings (See http://www.sublimetext.com/forum/viewtopic.php?f=6&t=3311) so I can't directly emulate the find-in-files results behaviour. Right now, I have no idea how that behaviour is implemented.

It is likely that I will release a version that supports keyboard navigation through the results; (n)ext, (p)revious, (c)lear selection and enter to jump to the line. See #6

OscarGodson commented 12 years ago

I'm not familiar with the API, but I'm assuming it must allow you to trigger a function on click. If so, could you grab the line clicked on? And if yes to that you could use a simple regex pattern with captures around important things you need like line numbers and use their API to open the file and go to the line number.

robcowie commented 12 years ago

Correct. I can bind functions to clicks using a .sublime-mousemap however, mousemap bindings don't support a context so all clicks - in all views - will attempt to run the bound function. The function could easily check to se if the current view is a todo results view, but it's horribly inefficient.

I'm also not sure it is possible to delegate to existing click handlers. If not, that would mean my click handler wil completely override the built in handlers. That would break things like double-click to select a word.

robcowie commented 12 years ago

I have a prototype working with keyboard nav and alt+double-click goto functionality working. Code needs a bit of tidying up and I need to test it for a while.

OscarGodson commented 12 years ago

@robcowie whoo! Let us know!

robcowie commented 12 years ago

I've pushed an update that implements keyboard and mouse navigation. alt-double click on a line in results to jump to the appropriate file and line.

Keyboard navigation is (n)ext, (p)revious, c(lear), enter.

As ever, feedback and bug reports gratefully received.