Creating custom open files patterns/styling


#1

Very interesting idea, I’ll consider adding something like this.

For what it’s worth, you could use CSS for this at the moment:

#openfilesListbox richlistitem.group-item > label[value="JavaScript"]
{
  color: red;
}

You can hide tabs by right clicking the toolbar and hitting “Show Editor Tabs”.

Be sure to also check out the customize mode; right click toolbar > Customize. In this mode you could combine the Open Files Widget with the Places widget (so they are stacked vertically). I tend to use Komodo this way myself.


Direction of Komodo
#2

Hi naatan,

thanks, that is useful meanwhile because you could also use wildcards as css attributes like:

#openfilesListbox richlistitem.group-item > label[value*="\controller"] { color: red; }

The downside of this method is that you’ll always have to display a “location/folder” heading which messes up the view especially if you have lots of single files opened. Maybe theres a solution in future to prevent this somehow.

Personally i tend to seperate the hierarchical file view and the opened files to prevent scrolling. Thats why i moved open files to the toolbox on the right side. Everything should be available as easy as possible without having to search or scroll.


#3

If you use custom patterns you can define your own group name and pattern, see:

http://komodoide.com/screencasts/open-files-widget/


#4

Thank you, this is exactly what i was searching for!

Unfortunately i didnt get it working although i followed exactly all steps described:

My example script:

ko.openfiles.groupers.byPattern.patterns = [
{
name: ‘Model’,
pattern: //(?:model|models)(?:/|$)/i
},
{
name: ‘View’,
pattern: //(?:view|views)(?:/|$)/i
},
{
name: ‘Controller’,
pattern: //(?:controller|controllers)(?:/|$)/i
},
];

ko.openfiles.reload(true);

Then i changed to “Pattern” and executed the userscript but nothing happened. There should be at least 3 groups with the defined headings because i’ve opened several files in these specified locations. Also tried to restart but didn’t help either.

Maybe there is something important which i have overlooked or there is a bug.


#5

That looks right to me. Are you sure you had files open that matched your patterns? If no pattern is matched Komodo falls back on grouping by language.

I just tried your exact userscript and it appears to be working correctly for me.

Could you share the exact script you’re testing with?


#6

Thank you for splitting the topic up to the “How-To” section :slight_smile:

Unfortunately thats all of my script. I thought i try a short version to check if it works - and enhance it later.

Sure i have opened a file of every section in my “open files” widget i’d like the pattern to match. Maybe there is an error in the regex itself, so i’ll have to figure out the problem because the regex isn’t working in the RxTools widget against the path (strange because you said it’s working in your environment).


#7

Again though, the exact snippet you shared works for me. So that would indicate it’s either something with your file paths or perhaps you didnt select the right grouping option in Open Files? It is also possible that something broke internally in Komodo, perhaps restarting Komodo and attempting it from a fresh start could help.