Here's a handy little Visual Studio .NET macro which searches for the currently highlighted term in Google. The search is launched as a new tab within the IDE when you press
I’d love a way for it to find the word the cursor is currently on, withOUT needing to select it. (That’s how VS.net’s integration with MSDN Library works.)
I don’t care for this behavior personally, but I guess it’s better than doing nothing, which is what happens when you hit ALT+F1 with nothing selected. I added it to the code in the entry…
Awesome! I added a CTRL+G mapped macro that did the same stuff but used http://www.google.com/q=site:msdn.microsoft.com+ as the query URL so that you can search MSDN through Google’s interface.
As it is, using the macro in VS.net 2003 gives me this error:
“Name ‘HttpUtility’ is not declared.” I had to import the System.Web namespace too, since HttpUtility is unqualified:
Imports System.Web
So I fixed that error. Next problem is that it doesn’t find any selected text.
In debugging, this is true:
DTE.ActiveWindow.Selection Is Nothing.
But this (change) is false:
DTE.ActiveDocument.Selection Is Nothing
So changing ActiveWindowSelection thus fixes it for me:
Return SelectionText(DTE.ActiveDOCUMENT.Selection)
I’d love a way for it to find the word the cursor is currently on, withOUT needing to select it. (That’s how VS.net’s integration with MSDN Library works.)
For this sort of behavior elsewhere than MSVC.net I’d like to recommend ClipX (a tiny clipboard history manager) at a href="http://bluemars.org/clipx/"http://bluemars.org/clipx//a which has the nifty feature of opening a browser with a Google search for the current clipboard contents with Control + Shift + G (or any other key you wish to configure for it.) Not quite as streamlined in that you have to first copy the text you wish to search but still quite useful.
Does the change to Diagnostics.Process.Start work for anyone? For me it causes this error: “The requested lookup key was not found in any active activation context.”
Jon – regardless of the way the call is qualified, you’ll still have to manually add a reference (via the right click Add Reference menu) to the IDE module.
If that wasn’t required, I’d totally agree with you.
And I also agree that simply “HttpUtility” alone is no good because it gives the developer no hint as to what reference is required. But I think “Web.HttpUtility” should be enough to figure it out. I mean, c’mon.