![](/img/trans.png)
[英]Automate refactor import/using directives, using ReSharper and Visual Studio 2010
[英]Go to closing Tag in Visual studio (using Resharper)?
我正在使用最新的Resharper(v 8.1)和visual studio 2010。
是否有“跳轉到結束標簽”的鍵盤快捷鍵/功能?
例如:如果光標在第一個tr
:
我希望光標轉到結束tr
,即</tr>
這有什么捷徑嗎?
(ps - 類似於goto matchine brace但是對於Xml / html標簽)
從我收集的內容來看,在reSharper或Visual Studio中沒有這樣的捷徑。 “解決方法”是使用Ctrl + M + M折疊標記,然后使用Home或End鍵轉到行的開頭或結尾。 當您使用Ctrl + M + M再次打開它時,您將位於標簽的頂部或底部。
我聽說ctrl + ]
可以解決問題
好的,這是我已經建立的宏的答案(切換),包括去焦點:
這是演示:
這是代碼,享受!
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 cursor somewhere in beginning tag, run 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.