在Visual Studio 2008中是否有一种方法可以将结束大括号转换为开始大括号?我发现了大量关于突出显示大括号的内容,但没有关于将光标移到大括号上的内容。
(VB。这个问题的NET版本:键盘快捷键在“If/End If”之间跳转)
在Visual Studio 2008中是否有一种方法可以将结束大括号转换为开始大括号?我发现了大量关于突出显示大括号的内容,但没有关于将光标移到大括号上的内容。
(VB。这个问题的NET版本:键盘快捷键在“If/End If”之间跳转)
当前回答
为了完整起见,在瑞典键盘上,它是CTRL + å。
另外,我认为这是合乎逻辑的,但值得一提的是CTRL + shift + å(对于大写Å),选择括号内的所有内容并转到匹配的内容。
其他回答
在我的葡萄牙语键盘上,使用EN VS, CTRL +«导航到匹配的大括号,如果您打算选择内部代码,则CTRL + SHIFT +«。
在Mac上使用command+shift+\。
来源:对这个答案的评论:https://stackoverflow.com/a/37877082/3345085。 在Visual Studio Code版本1.10.2中测试。
使用CTRL +]在它们之间切换。使用时将光标放在其中一个花括号上。
在西班牙语(西班牙)键盘上,VS2012是由@Keith表示的Ctrl +±,但如果你使用Ctrl +¿(键入为Ctrl + Shift +±),然后去匹配大括号+选择两个大括号内的所有代码,然后你不能再去另一个大括号。
有点相关,但对于HTML标签:(因为没有内置的解决方案,Ctrl + J不适用于HTML标签:)
下面是答案,作为一个宏,我已经建立了它(切换),包括去焦点:
下面是演示:
这是代码。享受吧!
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Windows.Forms
Public Module Module2
Sub beginToEnd()
'Place the cursor somewhere in the beginning tag, run the macro, to select from beginning to end tag
DTE.ActiveDocument.Selection.SelectLine()
Dim objSel As TextSelection = DTE.ActiveDocument.Selection
Dim topPoint As TextPoint = objSel.TopPoint
Dim lTopLine As Long = topPoint.Line
objSel.GotoLine(lTopLine, False)
' DTE.ActiveDocument.Selection.StartOfLine()
DTE.ActiveDocument.Selection.SelectLine()
Dim line1 As String = DTE.ActiveDocument.Selection.Text()
If InStr(line1, "/") Then
' MsgBox(line1)
DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, True)
objSel.GotoLine(lTopLine, False)
DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
Else
DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
DTE.ActiveDocument.Selection.EndOfLine(False)
DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
End If
DTE.ActiveDocument.Selection.SelectLine()
Dim line2 As String = DTE.ActiveDocument.Selection.Text()
Dim objSel3 As TextSelection = DTE.ActiveDocument.Selection
Dim topPoint3 As TextPoint = objSel3.TopPoint
Dim lTopLine3 As Long = topPoint3.Line
objSel.GotoLine(lTopLine3, False)
DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, False)
End Sub
End Module