I’ve been giving this a bit of a thrashing and may have just spotted a few bugs.
Mainly, I’ve been modifying the regexps to include file extensions, i.e.
I’ve found the following anomalies:
- New files get dumped in “All other”, even if the RegExp matches the extension
- Saved files appear to behave correctly
- Re-running the code deletes unsaved files from the tree, until the tab / editor pane is refocussed
- Windows machines seem to require \\ not / to distinguish folders
That’s about it for now. I’m throwing a bunch of expressions at it so will report back as and when I find things.
Here’s my alternate take on assigning patterns: https://gist.github.com/davestewart/11235539
It’s a bit easier on the eye / brain by converting strings to RegExps (note that the slash characters are just that - NOT RegExp delimiters)
Anyway, cool extensibility, would love for this to get its own menu item / dialog. Maybe I’ll look at building something at some point
Interesting take, but that does take away the flexibility that Regex gives you.
I should note that the current API method of adding patterns is not the solution I originally had in mind, what I wanted to do was allow you to define your own custom patterns through your Komodo IDE preferences, no programming required. I still intend to do this but at the moment I have a lot of other priorities. Hopefully something I’ll be able to get to for Komodo 9.
As for new files not being sorted/grouped properly - I’m aware of this and will be fixing it in a nightly soon. Note that this has nothing to do with Patterns and is a bug in Open Files in general.
Funny you should mention that, I’d just had the same thought that it would be good to allow pure RegExps as well, so I’ve added that:
Though the building RegExps from strings is equally valid, and allows you to solve the Windows back-slash issue pretty easily.
Yep - stick to the important stuff - these sorts of niceties should defo come after the core stuff we use every day is all shiny and nice
Another thing to keep in mind is that you can also add css classes to your groups (see the “Styling Groups” section in the “Organize Files With Patterns” blog), which your code doesn’t cover. I suppose the classes could be generated from the group name, but I hardly think the current format of patterns is too confusing.