zokugun / vscode-explicit-folding

Customize your Folding for Visual Studio Code
MIT License
95 stars 14 forks source link

Folding rule for ARM asm language yielding 'SyntaxError: Expected [gimsuxyUJX] or end of input but found " "' #84

Closed Tridecatrix closed 1 year ago

Tridecatrix commented 2 years ago

Versions used and details of configuration

VSCode 1.67.1 (system setup) Explicit Folding v0.21.0

Description of issue

I have this rule in my settings.JSON:

"explicitFolding.rules": {
    "arm": [
        {
            "beginRegex": "\/\/ <MAIN>",
            "endRegex": "\/\/ <\/MAIN>"
        }
    ]
}

with the additional settings:

"editor.showFoldingControls": "always",
"editor.foldingStrategy": "auto",
"explicitFolding.debug": true

And I'm testing it on this code in a .S file (ARM assembly code, specifically ARMv7-M):

// <MAIN>

// </MAIN>

If I understand how the extension works, there should be a folding region created between these two lines, but as far as I can tell it's not working; there's no white arrow in the gutter like there usually is. And the debug output is baffling me; what is gimsuxyUJX??:

SyntaxError: Expected [gimsuxyUJX] or end of input but " " found.
[document] lang: arm, fileName: c:\Users\adnan\Desktop\Work\2022\COMP2300\labs\comp2300-2022-lab-pack-4\week-12\src\main.S
[main] regex: /a^/
[document] foldings: []

Tests attempted

daiyam commented 2 years ago

You need to double escape:

    "[arm]": {
        "explicitFolding.rules": [
            {
                "beginRegex": "\\/\\/ <MAIN>",
                "endRegex": "\\/\\/ <\\/MAIN>"
            },
        ],
    },

or use string:

    "[arm]": {
        "explicitFolding.rules": [
            {
                "begin": "// <MAIN>",
                "end": "// </MAIN>"
            },
        ],
    },
daiyam commented 1 year ago

@Tridecatrix Have you been able to fix your issue?

Tridecatrix commented 1 year ago

Oh I believe yes, think I just forgot to close it sorry