• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Click "RG3" at the very bottom-left of this page to change it. To dismiss this notice, click the X --->

Tech - Visual Studio Code - Regions (1 Viewer)

Joined
May 30, 2015
RedCents
180¢
Im moving from a code editor to Visual Studio Code. I have regions placed in my code (for folding code) that I would like to get working in VSC. Are there any VSC guru's out there that can show me how to get this to work? Also, would like the code to be folded when I open the file.

Thanks

INI:
|'#region -----=====[ COMMON ]=====-----
sub DoCoolStuff



/return
|'#endregion
 
Joined
Sep 13, 2019
RedCents
6,531¢
Below is specific to Lua, but probably could do same with macro if that's what you're looking for, but the vscode-mq2 extension might already cover that for macros as well.

From MQ Discord:

https://github.com/trixnz/vscode-lua/issues/25#issuecomment-635286784
INI:
    "maptz.regionfolder": {
        "[lua]": {
            "foldEnd": "--endregion",
            "foldEndRegex": "[\\s]*--endregion",
            "foldStart": "--region [NaME]",
            "foldStartRegex": "[\\s]*--region[\\s]*(.*)"
        }
    }

But also, as noted there, there is still regular function / control structure based code folding even without that
 
Joined
Sep 27, 2020
RedCents
3,870¢
As @knave23 and @aquietone mention, the #region folding for VS Code extension will allow definition of custom region handling. The github link above points to a feature request for VSCode Lua which was implemented Dec 2018 (i.e., no extension required). I use --#region <region name text>/--#endregion in my code without it.

If you want to use the extension with MQ macros, I believe you'll need to define the language selector as [mq2macro] (assuming you have the vscodemq2 extension installed). Experimentation may be required.

Personal Opinion: I'd be inclined to define the MQ macro regions as |#region/|#endregion but that's mainly from a consistency with other languages perspective.
 
Last edited:

Users who are viewing this thread

Top