Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Method is ignorant of indentation #2285

Closed
ThunderFrame opened this issue Oct 5, 2016 · 2 comments
Closed

Extract Method is ignorant of indentation #2285

ThunderFrame opened this issue Oct 5, 2016 · 2 comments
Assignees
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-refactorings refactoring-extract-method work-item Used for features not implemented to document requirements

Comments

@ThunderFrame
Copy link
Member

The indentation of the extracted lines is preserved, and the indentation of the call to the new method is seemingly always 0 spaces.

Also note the error in the new method line placement - see comment in code below...

Before:

Sub foo()

  Dim x As String
  If True Then
    If True Then
      If True Then
        x = "foo"
      End If
    End If
  End If

End Sub

After:

Sub foo()

  If True Then
    If True Then
      If True Then
      End If
NewMethod 'Note this is also on the wrong line - it should be 1 line higher up
    End If
  End If

End Sub
Private Sub NewMethod()
  Dim x As String
        x = "foo"
End Sub
@retailcoder
Copy link
Member

This is by design, sort of - the refactoring was written before the indenter was finished - it's not a feature of the extract method refactoring to know how to indent code.

Changing from [bug] to [enhancement], since all that's needed is to call into the indenter interface when generating the extracted method.

@retailcoder retailcoder added enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. and removed bug Identifies work items for known bugs labels Oct 5, 2016
@bclothier
Copy link
Contributor

@Vogel612, please assign to me.

@bclothier bclothier added the work-item Used for features not implemented to document requirements label Aug 16, 2018
Current Epic automation moved this from TODO to Done Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-refactorings refactoring-extract-method work-item Used for features not implemented to document requirements
Projects
Current Epic
  
Done
Development

No branches or pull requests

3 participants