Skip to content

Indenter issue with "PtrSafe" #4795

Open
@ChrisBrackett

Description

@ChrisBrackett

Rubberduck version information
Version 2.4.0.4511
OS: Microsoft Windows NT 6.1.7601 Service Pack 1, x64
Host Product: Microsoft Office 2016 x86
Host Version: 16.0.4795.1000
Host Executable: EXCEL.EXE

Description
The indenter indents function declarations differently depending on the following:

  • Explicit Private declaration
  • Explicit Public declaration
  • Unspecified/implicit declaration
  • Use (or non-use) of PtrSafe

Un-Indented Code

Declare Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Public Declare Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Public Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Private Declare Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Private Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Indenter Result with 'Align Continuations'=TRUE and 'Ignore Operators'=FALSE

Declare Function GetDlgItem Lib "user32" _
        (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Declare PtrSafe Function GetDlgItem Lib "user32" _
        (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Public Declare Function GetDlgItem Lib "user32" _
                        (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Public Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Private Declare Function GetDlgItem Lib "user32" _
                         (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Private Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Indenter Result with 'Align Continuations'=TRUE and 'Ignore Operators'=TRUE

Declare Function GetDlgItem Lib "user32" _
        (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Declare PtrSafe Function GetDlgItem Lib "user32" _
        (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Public Declare Function GetDlgItem Lib "user32" _
                        (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Public Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Private Declare Function GetDlgItem Lib "user32" _
                         (ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr
    
Private Declare PtrSafe Function GetDlgItem Lib "user32" _
(ByVal hWndDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Expected behavior
I suppose I was expecting something a bit more uniform. Is this functioning as intended?

All Indenter Settings
image

Metadata

Metadata

Assignees

Labels

bugIdentifies work items for known bugsdifficulty-01-ducklingIssue where no particularly involved knowledge of the internal API is needed.feature-smart-indenter

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions