Move refactor reformats code :-(

I'm not sure if this is a scala thing or Idea in general. But does anybody know of a way to stop this destruction of my code? I have resorted to manual move refactorings.

0

If you are not satisfied with formatting, then this is formatting issue, and it needs some additional settings or fixes.
Can you provide such examples for us?

Best regards,
Alexander POdkhalyuzin.

0
Avatar
Permanently deleted user

There are three problems with white space. If I go to Preferences -> `Code Style` -> `Scala` -> `Spaces`, within the group `Within` the following settings are not respected:

- `Method call parentheses`
- `Method declaration parentheses`

Also there is no control over white space within constructor parentheses (I don't know if this is covered by the above two). So even if those two items are checked, I have

    class A(arg: Int) {
       def foo(): Int = 1

    
       def bar(i: Int) {
          if( i == 33 ) return
          println(i)
       }

    
       def generic[ A ](list: List[ A ]): A = list.head
    
       def curry(i: Int)(j: Int) {
          new A(33)
       }
    }


instead of

    class A( arg: Int ) {
       def foo(): Int = 1

    
       def bar( i: Int ) {
          if( i == 33 ) return
          println( i )
       }

    
       def generic[ A ]( list: List[ A ]): A = list.head
    
       def curry( i: Int )( j: Int ) {
          new A( 33 )
       }
    }


Note how in my style I "propagate" neighbouring white spaces "inwards", e.g.

    def generic[ A ]( list: List[ A ])
                     ^             ^

I don't know if this would be reproducable with the automatic formatting?

(by the way, it would be useful to have a default demo text like this one, instead of just `def foo()` which doesn't reflect most of the switches)

0
Avatar
Permanently deleted user

Sure, there may be some missing formatting settings. But still, I want to format when I say so, not as an uncontrolled side effect.

0
Avatar
Permanently deleted user

Having said that, tweaking the format settings is improving things a lot. Is it the case that some of the setting don't have a clear example that changes or am I just missing them?

0
Avatar
Permanently deleted user

The default demo text only reflects three or four of the dozens of switches. It should be really changed to a text where toggling any of the switches causes a visible change in the text.

0

We will change demo text this week. Sorry, that it was so simple...

Best regards,
Alexander Podkhalyuzin.

0

请先登录再写评论。