gpt4 book ai didi

visual-studio - 如何在Visual Studio 2015的 “Find Results”窗口中显示的行上添加调试断点

转载 作者:行者123 更新时间:2023-12-04 03:41:57 25 4
gpt4 key购买 nike

以前的Visual Studio(VS)版本已经回答了这个问题。所提供的解决方案涉及宏,而VS 2015中不再提供这些宏。我能否获得VS 2015的解决方案?

我想在VS中进行“查找全部”操作,并在查找匹配的每一行上放置一个调试断点。

链接到诺亚提出的先前问题:
How do I add Debug Breakpoints to lines displayed in a "Find Results" window in Visual Studio

最佳答案

我已将旧宏转换为Visual Commander中的VB命令(通过向类添加显式命名空间):

Public Class C
Implements VisualCommanderExt.ICommand

Sub Run(DTE As EnvDTE80.DTE2, package As Microsoft.VisualStudio.Shell.Package) Implements VisualCommanderExt.ICommand.Run
Dim findResultsWindow As EnvDTE.Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindFindResults1)

Dim selection As EnvDTE.TextSelection
selection = findResultsWindow.Selection
selection.SelectAll()

Dim findResultsReader As New System.IO.StringReader(selection.Text)
Dim findResult As String = findResultsReader.ReadLine()

Dim findResultRegex As New System.Text.RegularExpressions.Regex("(?<Path>.*?)\((?<LineNumber>\d+)\):")

While Not findResult Is Nothing
Dim findResultMatch As System.Text.RegularExpressions.Match = findResultRegex.Match(findResult)

If findResultMatch.Success Then
Dim path As String = findResultMatch.Groups.Item("Path").Value
Dim lineNumber As Integer = Integer.Parse(findResultMatch.Groups.Item("LineNumber").Value)

Try
DTE.Debugger.Breakpoints.Add("", path, lineNumber)
Catch ex As System.Exception
' breakpoints can't be added everywhere
End Try
End If

findResult = findResultsReader.ReadLine()
End While
End Sub

End Class

关于visual-studio - 如何在Visual Studio 2015的 “Find Results”窗口中显示的行上添加调试断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38061627/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com