我正在使用Visual Studio 2003.在调试模式下,每当我在javascript(js)文件中添加断点时,文件就会被锁定,以便无法编辑。
关闭标签并重新打开它似乎解锁了。
我想知道的是:为什么会发生这种情况,是否有某种设置可以防止这种情况发生?
答案 0 :(得分:1)
我认为这是设计上的。当您遇到断点时,Visual Studio会显示实际文件的副本。您无法在调试过程中对其进行编辑。
答案 1 :(得分:0)
找到此宏,它会自动关闭并重新打开您所在的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