oakmac / sublime-text-parinfer

Parinfer plugin for Sublime Text
ISC License
57 stars 8 forks source link

prevent extra indentations #32

Closed ItamarShDev closed 8 years ago

ItamarShDev commented 8 years ago

For some reason, when using objects, the indentations needed for the Parinfer is very deep E.g.

cabin/cabine {
                    :shared {
                              :test? (? $scope.mode.test)
                              :routing-data (when (? $scope.mode.test) (js->clj (? $scope.test.yaml.routing) :keywordize-keys true))
                              :comparative? (when (? $scope.history) (boolean (? $scope.history.originalTest)))}

                    :target target} 

instead of:

cabin/cabine {
   :shared {
      :test? (? $scope.mode.test)
      :routing-data (when (? $scope.mode.test) (js->clj (? $scope.test.yaml.routing) :keywordize-keys true))
      :comparative? (when (? $scope.history) (boolean (? $scope.history.originalTest)))}

   :target target}
oakmac commented 8 years ago

The example you gave is expected behavior for Paren Mode.

I assume this is happening when you first open a file using atom-parinfer?

ItamarShDev commented 8 years ago

Yes. Also sublime-parifner makes a mess if I don't follow this pattern. So this is expected behavior?

On Thu, Aug 25, 2016, 08:30 Chris Oakman notifications@github.com wrote:

The example you gave is expected behavior for Paren Mode https://shaunlebron.github.io/parinfer/#paren-mode.

I assume this is happening when you first open a file using atom-parinfer?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/oakmac/sublime-text-parinfer/issues/32#issuecomment-242284679, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6MG5i7WDS6duZGG2c-o8FXCU0RUXU7ks5qjShygaJpZM4Jpoft .

oakmac commented 8 years ago

So this is expected behavior?

Yes.

This is the core Parinfer algorithm working as expected: adjusting indentation to match paren structure. If you have not already, you might want to give the main Parinfer site a read for a thorough explanation of how and why the algorithm works the way it does.

Issue #46 and Issue #51 from the atom-parinfer repo might also be helpful.