Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Quick "highlight references" for local variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 27 2008 :  5:18:10 PM  Show Profile  Reply with Quote
I created this macro to highlight all references of a local variable:

Sub HighlightByContext()
    DTE.ExecuteCommand("VAssistX.FindReferencesinFile")
    DTE.ExecuteCommand("Window.ActivateDocumentWindow")
    DTE.ExecuteCommand("VisualAssistX.RefResultsToggleHighlight")
End Sub


I have assigned it to a keyboard shortcut, so I can access very easily on demand. If you run first time after visual studio start it will take seconds, but after that it will work like a charm. The last line is only needed if you haven't checked "Highlight References" in the Refactoring section of Visual Assist X Options Dialog.

The macro set the focus to the editor instead of find references results, so it will not break your workflow.

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jul 11 2008 :  1:50:45 PM  Show Profile  Reply with Quote
I like this

zen is the art of being at one with the two'ness
Go to Top of Page

sl@sh
Tomato Guru

Switzerland
204 Posts

Posted - Aug 25 2008 :  05:01:26 AM  Show Profile  Reply with Quote
Hmm, in VS 2003 the second command (Window.ActivateDocumentWindow) leads to an error. Is there any other way to invoke this action? I've tried and inserted spaces ("Window.Activate Document Window") because that is how the command is listed when I look at the customize dialog, but in that case the interpreter stops at the first space.

Any other suggestion? (apart from upgrading to a newer IDE....)

P.S.: I just realized that after the first line the document window still *is* the active window, so I actually don't need the second line. Or what else was it meant for?

Edited by - sl@sh on Aug 25 2008 05:04:14 AM
Go to Top of Page

GennadiyKorol
Ketchup Master

Israel
54 Posts

Posted - Sep 23 2008 :  4:16:54 PM  Show Profile  Reply with Quote
Good stuff, thanks!

Correctness might be a theoretical concept but incorrectness has practical implications.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 05 2008 :  08:00:32 AM  Show Profile  Reply with Quote
sl@sh: in VS2008/2005 (with VAX 1649) the focus will be on find references list. So it is maybe VS2003 specific or you may use old VAX?
Go to Top of Page

tieuvodanh
New Member

Vietnam
2 Posts

Posted - Jul 20 2009 :  1:45:39 PM  Show Profile  Reply with Quote
Hi,

How to use this macro? After putting it with a shortcut key and place this code in my code then Build will generate error when build my code.
something like: error C2146: syntax error : missing ';' before identifier 'HighlightByContext'
...
Could you help me know what we could with this macro?

Thank for your help !

This is life
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jul 20 2009 :  4:21:11 PM  Show Profile  Reply with Quote
This is an IDE macro, not normal source code. In VS2005 have a look at the menu items:

IDE Tools menu -> Macros -> Macro Explorer
IDE Tools menu -> Macros -> Macros IDE...

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000