添加断点时 JavaScript 文件被锁定

发布于 2024-10-20 06:45:25 字数 162 浏览 4 评论 0原文

我使用的是 Visual Studio 2003。在调试模式下,每当我在 javascript (js) 文件中添加断点时,该文件就会被锁定,因此无法对其进行编辑。

关闭选项卡并重新打开它似乎可以解锁它。

我想知道的是:为什么会发生这种情况?是否有某种设置可以防止这种情况发生?

I'm using Visual Studio 2003. In debug mode, whenever I add a break point in my javascript (js) file, the file then becomes locked so that it can't be edited.

Closing the tab and reopening it seems to unlock it.

What I'd like to know is: why does this happen and is there some kind of setting that would prevent this from happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

二手情话 2024-10-27 06:45:25

我认为这是设计使然。当您遇到断点时,Visual Studio 将显示实际文件的副本。调试期间无法编辑它。

I think this is by design. When you hit a breakpoint Visual Studio shows a copy of the actual file. You cannot edit it during debugging.

叫嚣ゝ 2024-10-27 06:45:25

找到这个宏,它会自动关闭并重新打开您所在的js页面,并将光标移回您所在的行。希望它对某人有用。

Imports EnvDTE
Imports System.Diagnostics

Public Module AllowJSModify

    Sub ReOpenWindow()
        Try
            'get line no
            Dim objCursorTxtPoint As EnvDTE.TextPoint = GetCursorTxtPnt()
            Dim intLine As Integer = objCursorTxtPoint.Line

            'get current filename
            Dim strActiveWindow = DTE.ActiveWindow.Document.FullName

            'close open file (auto-save)
            DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesYes)

            're-open file
            Dim item As EnvDTE.ProjectItem = DTE.Solution.FindProjectItem(strActiveWindow)
            item.Open()
            item.Document.Activate()

            'go to prev line no
            DTE.ActiveDocument.Selection.GotoLine(intLine)
        Catch ex As System.Exception
            MsgBox("You are not focused on a line of code.", MsgBoxStyle.Critical, "Error")
        End Try
    End Sub

    Private Function GetCursorTxtPnt() As EnvDTE.TextPoint

        Dim objTextDocument As EnvDTE.TextDocument

        Dim objCursorTxtPoint As EnvDTE.TextPoint

        Try

            objTextDocument = CType(DTE.ActiveDocument.Object, EnvDTE.TextDocument)

            objCursorTxtPoint = objTextDocument.Selection.ActivePoint()

        Catch ex As System.Exception

        End Try

        Return objCursorTxtPoint

    End Function

End Module

Found this macro which automatically closes and reopens the js page you are on, and moves the cursor back to the line you are on. Hope it comes in useful to someone.

Imports EnvDTE
Imports System.Diagnostics

Public Module AllowJSModify

    Sub ReOpenWindow()
        Try
            'get line no
            Dim objCursorTxtPoint As EnvDTE.TextPoint = GetCursorTxtPnt()
            Dim intLine As Integer = objCursorTxtPoint.Line

            'get current filename
            Dim strActiveWindow = DTE.ActiveWindow.Document.FullName

            'close open file (auto-save)
            DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesYes)

            're-open file
            Dim item As EnvDTE.ProjectItem = DTE.Solution.FindProjectItem(strActiveWindow)
            item.Open()
            item.Document.Activate()

            'go to prev line no
            DTE.ActiveDocument.Selection.GotoLine(intLine)
        Catch ex As System.Exception
            MsgBox("You are not focused on a line of code.", MsgBoxStyle.Critical, "Error")
        End Try
    End Sub

    Private Function GetCursorTxtPnt() As EnvDTE.TextPoint

        Dim objTextDocument As EnvDTE.TextDocument

        Dim objCursorTxtPoint As EnvDTE.TextPoint

        Try

            objTextDocument = CType(DTE.ActiveDocument.Object, EnvDTE.TextDocument)

            objCursorTxtPoint = objTextDocument.Selection.ActivePoint()

        Catch ex As System.Exception

        End Try

        Return objCursorTxtPoint

    End Function

End Module
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文