Programing

Visual Studio 확장 / 축소 키보드 단축키

lottogame 2020. 5. 17. 10:29
반응형

Visual Studio 확장 / 축소 키보드 단축키


이 질문에는 이미 답변이 있습니다.

Visual Studio에서 코드 파일이 열려 있으면 CTRL+ M또는 CTRL+ M+ O눌러 모든 코드 블록, 영역, 네임 스페이스 등을 축소 할 수 있습니다 .

어떻게 반대를하고 모든 것을 확장 할 수 있습니까?

나는 이것을 구글 검색했지만 작동하는 지름길을 찾을 수없는 것 같습니다!


정의로 축소

CTRL+ M,O

모든 개요를 확장

CTRL+ M,X

모든 것을 확장 또는 축소

CTRL+ M,L

이것은 TypeScript 및 JavaScript와 같은 다른 언어와도 작동합니다.


보시다시피, 이것을 달성하는 몇 가지 방법이 있습니다.

나는 개인적으로 사용합니다 :

모두 확장 : CTRL+ M+L

모두 축소 : CTRL+ M+O

보너스:

커서 위치에서 펼치기 / 접기 : CTRL+ M+M


Visual Studio 2015 :

Tools > Options > Settings > Environment > Keyboard

기본값 :

편집 정의 : CTRL + M+O

편집 축소 현재 지역 : CTRL + M+CTRL + S

편집. 전체 확장 외부 : CTRL + M+CTRL + X

편집. 확장 현재 지역 : CTRL + M+CTRL + E

IntelliJ의 바로 가기를 설정하고 사용하고 싶습니다.

편집. 정의 : CTRL + SHIFT + NUM-

편집 축소 현재 지역 : CTRL + NUM-

편집. 전체 확장 개요 : CTRL + SHIFT + NUM+

편집. 확장 현재 지역 : CTRL + NUM+


Ctrl+ MCtrl+를 사용할 수 있습니다P

이를 Edit.StopOutlining이라고합니다.


축소하려면 CTRL+ M+ O를 사용하고 CTRL+ M+를 사용하여 확장 할 수 있습니다 P. 이것은 VS2008에서 작동합니다.


도구-> 옵션-> 텍스트 편집기-> c #-> 고급으로 이동하여 파일을 열 때 첫 번째 확인란을 선택하십시오.

이것은이 문제를 영원히 해결할 것입니다


항상 Visual Studio에서 영역을 축소 / 확장하는 옵션을 포함하기를 원했습니다. 나는 그것을 할 다음과 같은 매크로를 가지고 있습니다.

Imports EnvDTE
Imports System.Diagnostics
' Macros for improving keyboard support for "#region ... #endregion"
Public Module CollapseExpandRegions
' Expands all regions in the current document
  Sub ExpandAllRegions()

    Dim objSelection As TextSelection ' Our selection object

    DTE.SuppressUI = True ' Disable UI while we do this
    objSelection = DTE.ActiveDocument.Selection() ' Hook up to the ActiveDocument's selection
    objSelection.StartOfDocument() ' Shoot to the start of the document

    ' Loop through the document finding all instances of #region. This action has the side benefit
    ' of actually zooming us to the text in question when it is found and ALSO expanding it since it
    ' is an outline.
    Do While objSelection.FindText("#region", vsFindOptions.vsFindOptionsMatchInHiddenText)
        ' This next command would be what we would normally do *IF* the find operation didn't do it for us.
        'DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
    Loop
    objSelection.StartOfDocument() ' Shoot us back to the start of the document
    DTE.SuppressUI = False ' Reenable the UI

    objSelection = Nothing ' Release our object

  End Sub

  ' Collapses all regions in the current document
  Sub CollapseAllRegions()
    Dim objSelection As TextSelection ' Our selection object

    ExpandAllRegions() ' Force the expansion of all regions

    DTE.SuppressUI = True ' Disable UI while we do this
    objSelection = DTE.ActiveDocument.Selection() ' Hook up to the ActiveDocument's selection
    objSelection.EndOfDocument() ' Shoot to the end of the document

    ' Find the first occurence of #region from the end of the document to the start of the document. Note:
    ' Note: Once a #region is "collapsed" .FindText only sees it's "textual descriptor" unless
    ' vsFindOptions.vsFindOptionsMatchInHiddenText is specified. So when a #region "My Class" is collapsed,
    ' .FindText would subsequently see the text 'My Class' instead of '#region "My Class"' for the subsequent
    ' passes and skip any regions already collapsed.
    Do While (objSelection.FindText("#region", vsFindOptions.vsFindOptionsBackwards))
        DTE.ExecuteCommand("Edit.ToggleOutliningExpansion") ' Collapse this #region
        'objSelection.EndOfDocument() ' Shoot back to the end of the document for
        ' another pass.
    Loop
    objSelection.StartOfDocument() ' All done, head back to the start of the doc
    DTE.SuppressUI = False ' Reenable the UI

    objSelection = Nothing ' Release our object

  End Sub
End Module

편집 : 이제 바로 편집을위한 Edit.ToggleOutliningExpansion (Ctrl + M, Ctrl + M)이라는 바로 가기가 있습니다.

참고 URL : https://stackoverflow.com/questions/14051589/visual-studio-expand-collapse-keyboard-shortcuts

반응형