I know this might not sound very useful to most people, but i really like having all my code collapsed in VS and it's getting kinda annoying having to ctrl+m ctrl+o everytime i'm closing a document.
Is there some add-in that does this, or can someone give me general tips to create the add-in? thanks
You can achieve the functionality you desire by creating a macro in visual studio that executes the CollapsetoDefinitions
command when ever the DocumentClosing
event is raised.
Simply go: Tools -> Macros -> Macros IDE.
Then add the following code to the EnvironmentEvents
module.
Private Sub DocumentEvents_DocumentClosing(ByVal Document As EnvDTE.Document) Handles DocumentEvents.DocumentClosing
Dim thread As New System.Threading.Thread(AddressOf CollapsToDefinition)
thread.Start()
End Sub
Public Sub CollapsToDefinition()
Try
If DTE.ActiveDocument Is Nothing Then Exit Sub
DTE.ExecuteCommand("Edit.CollapsetoDefinitions")
Catch
'Ignore any error
End Try
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With