jamalsenouci / sublimetext-syntaxfold

Sublime Text Plugin that provides a configurable command and popup for folding code based on syntax
MIT License
40 stars 6 forks source link

Can't make folding work #26

Closed inl-pd-autotest closed 7 years ago

inl-pd-autotest commented 7 years ago

Hi, Looks like the folding is not working for me. I'm trying to make it work for python (*.py) files and I want the startMarker to be literal text #;{ and endMarker to be literal text #;}. Note that # is the start of a comment in python.

So in Preferences > Package Settings > SyntaxFold > Settings - User I tried to add

,
        {
            "scope": "python.py",
            "startMarker": "#;{",
            "endMarker": "#;}"
        }

and I also tried without the scope line - the folding still doesn't work for me. What am I doing wrong and how to achieve what I want?

Armfoot commented 7 years ago

You need to add source.python instead.

You can always check the "scope name" of any file by pressing Ctrl+Shift+Alt+P in the active tab. In a recent pull request I made with updates to this plugin, I made this point clearer in the README file and also added support for text/HTML files and a toggle command (fold and unfold depending on the region's state).

inl-pd-autotest commented 7 years ago

Thanks, this way it works, but in a strange way... Does this plugin support nested folding blocks? So I've changed scope from python.py to source.python as you suggested, now the folding is like this:

I expect folding buttons to be at lines 21, 26, 36, 43.

inl-pd-autotest commented 7 years ago

Just realized that it might be due to the plugin expecting the startMarker and endMarker to be at the line start exactly, while I have whitespace characters (well, tab characters, to be precise) there first. I guess the plugin doesn't support regex syntax for the markers?

inl-pd-autotest commented 7 years ago

Ha, turns out it is both: the plugin expects startMarker to be exactly at line start AND it also currently doesn't support nesting (requested by #14 ).