Serpen / VBS-VSCode

VSCode VBScript language extension
https://marketplace.visualstudio.com/items?itemName=Serpen.vbsvscode
MIT License
24 stars 12 forks source link

Add Code/Region Folding Support #49

Open franklesniak opened 3 years ago

franklesniak commented 3 years ago

Is it possible for you to add "folding" support? For example, in PowerShell, I can write:

region Foo

Some Code here Some More Code Here .... 100 Lines Later

endregion Foo

Then hover my house over the #region Foo line and collapse it. It's super convenient for organizing chunks of code.

I'd like to do something similar with VBScript like:

'region Foo ... 'endregion Foo

What do you think?

Serpen commented 3 years ago

Hi, currently I'm afraid of adding pseudo statements which aren't in the vbs standard.

Everyone might use a different, i would prefer a variant near vb.net (and ps)

'#Region "Name"

'#End Region

Consider using an extension like #region folding for VS Code (I haven't tested it!)

You could modify your local installed extension, but be aware every new version needs to be customized again:

Add following to this file "%userprofile%\.vscode\extensions\serpen.vbsvscode-1.2.0\syntaxes\language-configuration.json"

[...]
"folding": {
        "markers": {
            "start": "'region",
            "end": "'endregion"
        }
    }

(I haven't tested this completly, but initial it seems to work, so make a backup)

franklesniak commented 3 years ago

Awesome - thank you for the suggestions. I will put these to use.

If you do decide to build in support, for the record, I'm fine with whatever variant you propose - you are the author!