crystal-lang-tools / sublime-crystal

Crystal syntax highlighting for Sublime Text
Other
86 stars 18 forks source link

Stop removing all spaces after save file #20

Closed papilip closed 6 years ago

papilip commented 7 years ago

Hello,

When i save a file .cr I tabulate my code with spaces, all of then are deleted.

var1   = "var1"
myvar2 = "myvar2"

=>

var1 = "var1"
myvar2 = "myvar2"

How to delete this action and move it to a function key. Saving my code should not transforme my code silently, without permission !

faustinoaq commented 7 years ago

How to delete this action and move it to a function key.

Is a crystal formatting convention, just constants, hashes and name tuples should be aligned.

faultyserver commented 7 years ago

You can also add "auto_format": false to your syntax-specific settings for Crystal to disable the automatic formatting when you save a file, e.g.:

{
  "auto_format": false,
  "crystal_cmd": "crystal"
}

"Crystal: format" will still be available in the command palette, and you should be able to set up a keybinding for it manually.

As for the spacing being an option in the formatter, that's almost definitely not going to happen. The Crystal formatter is opinionated, but consistent, and options for stylistic choices are not being added.

papilip commented 7 years ago

Thank both for solution and link.

RX14 commented 7 years ago

We do recommend people still with the crystal formatter though, so that all crystal programs have a consistent style.