locked
VS2010 | VB.NET - Automatic Outlining RRS feed

  • Question

  • Hello MSDN!

    I use a VB VS2010 ...

    By default, VS does't define
    section If, Else, Case, Try, etc. for collapse when working with code

    I tried to manually create
    sections (Ctrl+M+H), but after a certain collapse points or after reboot VS ( sometimes ) - they are not saved ...

    I stumbled on the article http://msdn.microsoft.com/ru-RU/library/td6a5x4s.aspx

    "
    As you type new definitions, the Code Editor automatically creates hidding sections around the blocks of new code" (c)

    From here follows - when you turn this option (which is the default), the studio should be determine the blocks ... But strangely enough, the studio considers the correct sections are modules, classes, function and procedures ...

    Is it possible to make an automatic determination
    sections, such as If, Select, Case, Try, etc?
    • Moved by Brittany Behrens Friday, September 24, 2010 9:39 PM (From:Visual Studio Editor)
    Saturday, September 18, 2010 1:53 PM

Answers

All replies

  • Hi FireFenix,

     

    Thanks for your post.

    I suppose you'd like to create some custom region of matched braces like if+else, try+catch, etc, and the regions can be outlined as you wish.

    For this case, I suggest to create a outlining tagger, for more information, please check:

    http://msdn.microsoft.com/en-us/library/ee197665.aspx

    This walkthrough indicates how to make this kind of regions.

    If I misunderstand your issue, be free to let me know.

     

     

    Best Regards,

    Ziwei Chen

     

    Tuesday, September 21, 2010 2:37 AM
    Moderator
  • Thanks, that is I needed!

    For obtaining parameters TabSize and IndentSize in Visual Studio I used:

        Dim Type As Type = Type.GetTypeFromProgID("VisualStudio.DTE.10.0")
    
        If Type Is Nothing Then
          Params.TabSize = 4
          Params.IndentSize = 4
          Params.InsertTabs = False
        Else
          Dim DTE As EnvDTE.DTE = DirectCast(Activator.CreateInstance(Type), EnvDTE.DTE)
          Dim Properties As EnvDTE.Properties = DTE.Properties("TextEditor", "Basic")
    
          Params.TabSize = Properties.Item("TabSize").Value
          Params.IndentSize = Properties.Item("IndentSize").Value
          Params.InsertTabs = Properties.Item("InsertTabs").Value
        End If
    
    Can I get parameters via variables, such as obtain text buffer in TagProvider?
    Thursday, October 7, 2010 11:31 AM
  • Hi FireFenix,

    Here  http://visualstudiogallery.msdn.microsoft.com/zh-tw/96f0b449-3809-49bf-9af1-a89cd8300ded

    I wrote one  for vs2010 vb.net statements , 

    sorry~ i am not good at english.

     

    • Marked as answer by FireFenix Monday, April 4, 2011 4:30 PM
    Thursday, January 6, 2011 4:10 AM