Custom folding for Sublime Text 3

懵懂的女人 提交于 2020-01-02 06:29:12

问题


I am trying to get custom folding for sublime text 3, namely the markers:

*--#[
    some stuff
*--#]

indicate my region. I tried AAAPacakgeDev, but it doesn't seem to support folding. The package SyntaxFold introduces its own logic and new keybindings, which seems unnecessary.

It seems .tmLanguage does support folds, so what I did is I copied Obective-C.tmLanguage from its package to Packages\FORM and renamed it to `FORM.tmLanguage'. Then I modified the markers to:

<key>foldingStartMarker</key>
<string>^\*..#\[.*$</string>
<key>foldingStopMarker</key>
<string>^\*..#\].*$</string>

and changed the syntax to FORM. Even though the colors change and the pattern matches when I do a regex on the code, the folds are not working.

What am I doing wrong?


回答1:


Apparently, this is a long-time requested feature. I found the SyntaxFold package to be a convenient substitute. My configuration file looks like:

    {
        "endMarker": "^\\*..#\\][^\n]*$",
        "name": "Form",
        "startMarker": "^\\*..#\\[[^\n]*$"
    },

I also made the key bindings the same as the normal folds.



来源:https://stackoverflow.com/questions/31851717/custom-folding-for-sublime-text-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!