好的,这只是一个疯狂的想法。 Stack Overflow看起来非常结构化,可以集成到开发应用程序中。那么,有可能,甚至是有用的,有一个Stack Overflow插件,比如Eclipse吗?

您希望将Stack Overflow的哪些功能直接集成到IDE中,以便您可以“本机地”使用它。无需更改浏览器?

编辑:我正在考虑更深层次的集成,而不仅仅是使用IDE中的网页。就像你使用某个Java类并遇到问题一样,来自SO的答案可能会爆发。可能会出现类似这样的事情令人讨厌的情况,但其他人可能会非常有帮助。

有帮助吗?

解决方案

跟进Josh的回答。此VS宏将在Visual Studio IDE中搜索StackOverflow以查找突出显示的文本。只需突出显示并按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

安装:

  1. 转到工具 - 宏 - IDE
  2. 在“MyMacros”下创建一个名为您选择的新模块。或使用现有模块。
  3. 将上述代码粘贴到模块中
  4. 将对System.Web命名空间(对于HttpUtility)的引用添加到模块
  5. 关闭宏IDE窗口
  6. 转到工具 - 选项 - 环境 - 键盘
  7. type“google”在包含文本框的显示命令中。 SearchGoogleForSelectedText宏应显示
  8. 单击Press Shortcut Keys文本框,然后按ALT + F1
  9. 点击“分配”按钮
  10. 点击确定
  11. 这全部来自Jeff Atwood的 Google Search VS Macro 帖子,只是修改为搜索StackOverflow而不是。

其他提示

我认为我无法通过集成到IDE中完成任何工作。它几乎和将Digg / Reddit集成到IDE中一样糟糕。

在Visual Studio中,您可以添加快捷方式以在StackOverflow中搜索突出显示的术语。杰夫阿特伍德写了他在 Google搜索VS.NET宏博客条目。

使用此方法可以突出显示术语或错误消息(或IDE中的任何其他可选文本),按快捷键,然后在StackOverflow上查看所有匹配结果。

我确信在其他IDE中也有办法实现这一点。

如果StackOverflow可以开始识别每个代码片段所包含的语言,那么我可以看到一个IDE的代码完成/代码片段插件,该插件响应用于在SO上执行搜索并插入接受的代码部分的特殊语法答案。

例如:在我的来源中,我可能会输入:

//# read an XML file

//#语法提示插件开始搜索并显示问题标题列表。当我选择一个时,它会插入接受答案的代码部分。

我不了解Eclipse,但对于Visual Studio,如果有人真的想要这个,他们可以轻松地为“起始页新闻频道”添加SO RSS提要。所以SO问题列表出现在起始页面中,甚至更好,用标签缩小范围(对于C#)。它并不完全是“集成”,但它可以用极少的努力快速查看最近的事情。但是,不确定如何“有用”。它会。

您可以使用Eclipse的 RSS插件来阅读StackOverflow进料。

但是我和你在一起,一个SO Eclipse插件真的很酷。

您可以在Visual Studio中将其设置为起始页。

不确定这会带来什么好处......但是对于他自己的每个人都有。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top