views:

576

answers:

7

Okay, this is just a crazy idea I have. StackOverflow looks very structured and integrable into development applications. So would it be possible, even useful, to have a StackOverflow plugin for, say, Eclipse?

Which features of StackOverflow would you like to have directly integrated into your IDE so you can use it "natively" without changing to a browser?

EDIT: I'm thinking about ways of deeper integration than just using the web page inside the IDE. Like when you use a certain Java class and have a problem, answers from SO might flare up. There would probably be cases where something like this is annoying, but others may be very helpful.

A: 

You could just set it as your Start Page in Visual Studio.

Not sure what benefit this would provide... but to each his own.

Geoffrey Chetwood
+3  A: 

I don't know about Eclipse, but for Visual Studio, if someone really wanted this they could easily add the SO RSS feed for the "Start Page News Channel" so the SO question list appeared in the start page, or even better, narrow it down with a tag (like for C#). It's not exactly "integration", but it would provide a quick look at recent things with extremely little effort. However, not sure how "useful" it would be.

Ryan Farley
We do exactly that (RSS). It provides a quick and easy way to skim the topics.
Gerard
+5  A: 

In Visual Studio, you could add a shortcut to search for a highlighted term in StackOverflow. Jeff Atwood wrote about doing something similar with Google in his Google search VS.NET macro blog entry.

Using this approach would allow you to highlight a term or error message (or any other selectable text in the IDE), press the shortcut keys, and then see all the matching results on StackOverflow.

I'm sure there's a way to do this in other IDE's as well.

Josh Sklare
+1  A: 

You have the RSS plugin for Eclipse to read the StackOverflow feed.

But I'm with you, a SO Eclipse plugin would be really cool.

Kristian
+3  A: 

If StackOverflow can begin identifying the language that each code snippet contains, then I could see an code-completion/code-snippet plugin to an IDE that responds to a special syntax for performing searches on SO and inserting the code portion of accepted answers.

Eg: in my source I might type:

//# read an XML file

The //# syntax prompts the plugin to start a search and display a list of question titles. When I pick one, it inserts the code portion of the accepted answer.

C. Lawrence Wenham
Meh - copy/pasted code in general is a menace - I'd hate to make it easier than it already is.
Erik Forbes
Yunwen Ye's PhD thesis did something like this. It was an Emacs plugin called CodeBroker, and did some natural language parsing of comments and attempted to infer the programmer's intention and make suggestions of existing code that does something similar.
Gabe Johnson
+10  A: 

I don't think I'll be able to get any work done with SO integrated into an IDE. Its almost as bad, if not worst than integrating Digg/Reddit into an IDE.

Kevin Chan
+14  A: 

Following up on Josh's answer. This VS Macro will search StackOverflow for highlighted text in the Visual Studio IDE. Just highlight and press Alt+F1

Public Sub SearchStackOverflowForSelectedText()
    Dim s As String = ActiveWindowSelection().Trim()
    If s.Length > 0 Then
        DTE.ItemOperations.Navigate("http://www.stackoverflow.com/search?q=" & _
            Web.HttpUtility.UrlEncode(s))
    End If
End Sub

Private Function ActiveWindowSelection() As String
    If DTE.ActiveWindow.ObjectKind = EnvDTE.Constants.vsWindowKindOutput Then
        Return OutputWindowSelection()
    End If
    If DTE.ActiveWindow.ObjectKind = "{57312C73-6202-49E9-B1E1-40EA1A6DC1F6}" Then
        Return HTMLEditorSelection()
    End If
    Return SelectionText(DTE.ActiveWindow.Selection)
End Function

Private Function HTMLEditorSelection() As String
    Dim hw As HTMLWindow = ActiveDocument.ActiveWindow.Object
    Dim tw As TextWindow = hw.CurrentTabObject
    Return SelectionText(tw.Selection)
End Function

Private Function OutputWindowSelection() As String
    Dim w As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
    Dim ow As OutputWindow = w.Object
    Dim owp As OutputWindowPane = ow.OutputWindowPanes.Item(ow.ActivePane.Name)
    Return SelectionText(owp.TextDocument.Selection)
End Function

Private Function SelectionText(ByVal sel As EnvDTE.TextSelection) As String
    If sel Is Nothing Then
        Return ""
    End If
    If sel.Text.Length = 0 Then
        SelectWord(sel)
    End If
    If sel.Text.Length <= 2 Then
        Return ""
    End If
    Return sel.Text
End Function

Private Sub SelectWord(ByVal sel As EnvDTE.TextSelection)
    Dim leftPos As Integer
    Dim line As Integer
    Dim pt As EnvDTE.EditPoint = sel.ActivePoint.CreateEditPoint()

    sel.WordLeft(True, 1)
    line = sel.TextRanges.Item(1).StartPoint.Line
    leftPos = sel.TextRanges.Item(1).StartPoint.LineCharOffset
    pt.MoveToLineAndOffset(line, leftPos)
    sel.MoveToPoint(pt)
    sel.WordRight(True, 1)
End Sub

To install:

  1. go to Tools - Macros - IDE
  2. create a new Module with a name of your choice under "MyMacros". Or use an existing module.
  3. paste the above code into the module
  4. add a reference to the System.Web namespace (for HttpUtility) to the module
  5. close the macro IDE window
  6. go to Tools - Options - Environment - Keyboard
  7. type "google" in the Show Commands Containing textbox. The SearchGoogleForSelectedText macro should show up
  8. click in the Press Shortcut Keys textbox, then press ALT+F1
  9. click the Assign button
  10. click OK

This is all taken from Jeff Atwood's Google Search VS Macro post, just modified to search StackOverflow instead.

Chris Lawlor
Is there a similar way to do this in Eclipse?
Thorsten79
I made a slight change to your macro, the "s=" now seems to be a "q="
1800 INFORMATION