ActiveState Powered by ActiveState

ActiveState Community


Feature Request: Always Collapse Folds

Posted by xian on 2007-08-21 15:17
OS: All / Any

Would be great to have an option to always Collapse All Folds when opening files. Make working with larger files much easier.

Thanks.

ToddW | Tue, 2007-08-21 15:46

Given that most people will not have a need for this and the fact that people can do this with a macro, it will not likely make it as a Komodo preference option.

You can do this currently by:

  • In your Komodo toolbox, create a JavaScript macro named "collapse all folds" with the following contents:
    // Focus is to ensure we are performing the command on the editor window!
    ko.views.manager.currentView.scintilla.focus();
    // Collapse all the folding.
    ko.commands.doCommand("cmd_foldCollapseAll");
    // Focus is to ensure we are performing the command on the editor window!
    ko.views.manager.currentView.scintilla.focus();
    // Collapse all the folding.
    ko.commands.doCommand("cmd_foldCollapseAll");
  • In the macro "Triggers" tab section, make the macro trigger on the "after file open" event.

Now, everytime you open a Komodo file your macro will fire, collapsing all the fold marks.

Cheers,
Todd

xian | Tue, 2007-08-21 15:49

I am getting the following error when I run the above.

Error while running in macro collapse all folds:

TypeError: ko.views.manager has no properties

exception[message] = ko.views.manager has no properties
exception[fileName] = chrome://komodo/content/project/peMacro.js
exception[lineNumber] = 426
exception[stack] = ()@chrome://komodo/content/project/peMacro.js:426
macro_evalAsJavascript("// Focus is to ensure we are performing the command on the editor window!\nko.views.manager.currentView.scintilla.focus();\n// Collapse all the folding.\nko.commands.doCommand(\"cmd_foldCollapseAll\");",[object XPCWrappedNative_NoHelper])@chrome://komodo/content/project/peMacro.js:426
_executeMacro([object XPCWrappedNative_NoHelper],true)@chrome://komodo/content/project/peMacro.js:180
macro_executeMacroById("8f841c5b-4448-4a1a-b104-6cb5f9083cfd",true)@chrome://komodo/content/project/peMacro.js:154
@chrome://komodo/content/project/peMacro.js:138

exception[name] = TypeError

ToddW | Tue, 2007-08-21 15:54

Yes, sorry about that. For Komodo 4.1 and earlier you'll need to use this macro:

// Focus is to ensure we are performing the command on the editor window!
gViewMgr.currentView.scintilla.focus();
// Collapse all the folding.
ko.commands.doCommand("cmd_foldCollapseAll");
// Focus is to ensure we are performing the command on the editor window!
gViewMgr.currentView.scintilla.focus();
// Collapse all the folding.
ko.commands.doCommand("cmd_foldCollapseAll");

Cheers,
Todd

-->