xtremebad.blogg.se

Visual studio code javascript regions
Visual studio code javascript regions










The only required change to have it in AL is to add information about region start and region end to language configuration file. Second case seems much better for us as it uses standard comments and should not have any impact on AL compiler.Īfter a bit of time with google and VS Code source code I’ve found how this functionality has been implemented. If you open C# of JavaScript file in VS Code, you will see, that it is possible to use #region and #endregion tags in C# and //#region and //#endregion tags in JavaScript. If you indent your code properly, it should be enough to be able to collapse content of each procedure or loop, but it is not enough to group a few procedures into a logical region and collapse them all into a single line with just a description. I really like this functionality, so I started searching if there is any way of getting it for AL files in Visual Studio Code.ĭefault Visual Studio Code functionality uses indentation to detect foldable regions. I have made a few modifications to the Macro to support more advanced code collapse.I am using foldable regions in each of my C# project as they allow me to split content of bigger classes into much smaller parts.

visual studio code javascript regions

Regarding #region in general, this SO Question covers it quite well.

visual studio code javascript regions

Still, I do find occasions where collapsing functions to their definitions makes browsing through a file much easier. Darin Dimitrov also makes a good argument about limiting the complexity of your JS files. I don't know why - I just entered it first time and use it now :)

  • now in textbox under the "Press shortcut keys" you can enter the desired shortcut.
  • If startIndex -1 AndAlso startIndex Options->Environment->Keyboard and search for your macro in "show commands containing" textbox If startIndex = -1 AndAlso endIndex = -1 Then

    visual studio code javascript regions

    StartIndex = text.IndexOf(REGION_START, lastIndex)ĮndIndex = text.IndexOf(REGION_END, lastIndex)

  • Click Edit macro and paste the following VB code:ĭim selection As EnvDTE.TextSelection = Ĭonst REGION_START As String = "//#region"Ĭonst REGION_END As String = "//#endregion".
  • You have to use Visual Studio 2003/2005/2008 Macros.Ĭopy + Paste from Blog entry for fidelity sake: Blog entry here explains it and this MSDN question.












    Visual studio code javascript regions