Google Answers Logo
View Question
 
Q: Visual Studio Add-In: outlining/code-collapse ( No Answer,   3 Comments )
Question  
Subject: Visual Studio Add-In: outlining/code-collapse
Category: Computers > Programming
Asked by: lameduck-ga
List Price: $50.00
Posted: 14 Jun 2006 17:03 PDT
Expires: 14 Jul 2006 17:03 PDT
Question ID: 738217
Question: How do you remove outlining from a selection of code or from
all code on an open document in MS Visual Studio in an Add-Id?

Background:  I'm attempting to write an add-in for Visual Studio that
will allow for code collapse (outlining) in JavaScript.  I'm looking
to mimmik the code collapse feature from C# or VB.net which is also
known as regions.  This feature allows users to shrink down any amount
of code to one line and give it a title so that large amounnts of code
can be viewed easily.  It is referred to as outlining, code-collapse,
and regions.  After some research, I was able to create outlining
around any selection of code I want using the line
"selection.OutlineSelection();".

Purpose:  Once I have outlined some code using my Add-In (ex. I
currently outline the brackets of functions) I need to be able to
remove that oulining should the user invalidate the region (ex. By
deleting one of the brackets of the function).  This way, I can
dynamically remove and add in outlining as the user types, just like
in C#/VB.NET.

Acceptable Answer:  A simple push in the right direction will suffice,
such as by providing the appropriate function name to remove a single
outlining/all outlining on the active document or showing me the
correct method (perhaps I'm looking at this from the wrong
perspective).  I will also accept being pointed to a source that will
definitely have the answer (a help number for MS developers) etc, but
obviously I would strongly prefer an answer now.

Unacceptable Answer: I realize that Add-Ins support the ability to
access the tools->options menu to turn off all regions.  This is
unnaceptable because 1) it would remove outlining from C# and VB.NET
pages as well, and my Add-In should only affect JavaScript pages, and
2) my goal is to be able to create, remove, and redefine outlining in
JavaScript on the fly, and as such turning off all regions would
prevent the creating part.

I will be happy to respond to any requests for clarifiacation, and
thanks in advance for any help.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Visual Studio Add-In: outlining/code-collapse
From: josiwe-ga on 15 Jun 2006 12:37 PDT
 
The outlines are drawn by the language service behind the scenes.
Microsoft does not provide a method to "remove" an outlining section.
In fact, if you examine the automatic behavior in C#, you'll see that
deleting a bracket does not invalidate an outlining section
immediately. There's some weird behavior that happens if, for example,
you delete a closing bracket on an outlining section and then collapse
a separate outlining section immediately prior to the one you just
invalidated.

To recreate the expected behavior in an intuitive manner, your Add-in
should probably capture keypresses, catch closing brackets, and then
figure out what constitutes the section that should be outlined. Don't
worry about removing outline regions - let the user handle the rest
with the Edit menu. Instead provide a parsing model that automatically
outlines functions etc in the same way that VS.NET does it for C#.

HTH, HAND :)

- Josiwe
Subject: Re: Visual Studio Add-In: outlining/code-collapse
From: lameduck-ga on 16 Jun 2006 07:09 PDT
 
Thanks Josiwe,  I think I see what you're saying, but I'm still
unclear.  Right now, when a user removes an end region bracket in my
JS add-in and then recreates the end region lower in the code, it will
automatically create a new outlining spanning from the start region
bracket to the new end location, however it still leaves the old
outlining in place which looks confusing.  are you saying that there
are functions the user can use from an edit menu to remove that
dangling region?
Subject: Re: Visual Studio Add-In: outlining/code-collapse
From: josiwe-ga on 16 Jun 2006 18:43 PDT
 
Unfortunately, what I outlined for you was the best I could do. The
only advice I can offer is to endure the things you cannot change.
Don't give up, though; you never know when a MSFT SME will come along
to the rescue.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy