How to enable indent-fold addon

I have been struggling to get this addon working. I’m using CM 3.19 because of the ES5 support.

The CM object shows the module loaded:

When I instantiate a new object, the method is not available:

The examples on the main site show how to bind hotkeys to the function, but not how to “enable” it.

Assistance is always appreciated!

I’m not sure what that means, but all CodeMirror versions are released as ES3 code, and the JavaScript mode also handles ES5 just fine.

To use a folding function, you have to use the foldcode addon.

Let’s separate the issues.

I have been able to get the hinting to work using the following code:

  var ta = document.getElementById('test');
    p_redaktor['test'] = {};
    p_redaktor['test'] = CodeMirror.fromTextArea(ta, {
        lineNumbers: true,
        mode: 'qmbasic',
        indentUnit: 4,
        extraKeys: {
            "Ctrl-Space": "autocomplete"
        },
        theme: 'cobalt'
    });

I do not see a clear connection on why this works. Is it always necessary to define an Addon with an extraKeys entry?

No, that depends on the addon – if it defines a command, then binding it to a key is probably what you want. If it defined an option, you’ll want to set that option. Some just define new methods, etc. Read the documentation for the addon.

Yes, I’ve read the documentation several times. :slight_smile:
I always read documentation before asking for help. We programmers are really great at describing our product to ourselves .