vscode-glua-enhanced icon indicating copy to clipboard operation
vscode-glua-enhanced copied to clipboard

Incompatiblity with maptz.regionfolder

Open TheOnly8Z opened this issue 2 years ago • 2 comments

I tried using RegionFolder with a custom configuration to be able to fold my code blocks. GLua files seem to prevent this extension from creating fold spaces even though the same file and configuration works with regular Lua. https://marketplace.visualstudio.com/items?itemName=maptz.regionfolder

To Replicate

I am using the following configuration for this extension in settings.json. This setup is identical to the one in the extension, but renamed for glua instead of lua.

    "maptz.regionfolder": {
        "[glua]": {
            "foldEnd": "--#endregion",
            "foldEndRegex": "--[\\s]*#endregion",
            "foldStart": " --#region [NAME]",
            "foldStartRegex": "--[\\s]*#region[\\s]*(.*)"
        }
    },

When the file is configured as GLua (bottom right language setting), the folding widgets do not appear even though regions are defined correctly. image

After switching language to Lua, the fold widgets immediately become visible and can be used to collapse code. image image

If I switch back to GLua without folding anything, the fold widgets disappear.

Curiously however, if the fold regions are folded before switching from Lua to GLua, they remain folded and can be used without disappearing, persisting even after the file is closed and reopened and within new windows.

image

The ability to fold certain user-defined regions is super convenient for large, sectioned bulk files that have segments but no code blocks for each. If this can be resolved (or something similar implemented into GLua Enhanced) it'd be a great producibility tool.

TheOnly8Z avatar Sep 29 '23 21:09 TheOnly8Z

The extension has to register a new "language" in order for GLua Enhanced to not load when editing normal Lua files, therefore, extensions for the Lua language will not work with the GLua language

WilliamVenner avatar Sep 29 '23 21:09 WilliamVenner

The extension has to register a new "language" in order for GLua Enhanced to not load when editing normal Lua files, therefore, extensions for the Lua language will not work with the GLua language

That is true, and I have set custom configuration for the extension to make it work with GLua.

In addition to the above issue, I also noticed that when both extensions are active, GLua Enhanced can't generate its own folding widgets for functions and code blocks. My guess is that this seems to be related to two extensions modifying folding behavior at the same time.

TheOnly8Z avatar Oct 05 '23 20:10 TheOnly8Z