-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add function to format region/file #8
Labels
Milestone
Comments
lucaswerkmeister
added a commit
that referenced
this issue
May 13, 2017
Part of #8. Error handling isn’t great (I managed to move the error output to a separate buffer, but it still replaces the region with stdout, which in case of error is empty), but a fix for that will probably be a bit involved. There are also numerous improvements to be made: fall back to entire buffer if there is no region (the other part of #8); strip the trailing newline if it wasn’t there in the original code; adjust indentation (probably just copy the indentation of the beginning of the region and prepend it to all following lines).
lucaswerkmeister
added a commit
that referenced
this issue
May 13, 2017
lucaswerkmeister
added a commit
that referenced
this issue
May 13, 2017
lucaswerkmeister
added a commit
that referenced
this issue
May 13, 2017
lucaswerkmeister
added a commit
that referenced
this issue
May 13, 2017
The initial indentation of the first line can be partially within the region and partially outside of it. For example, suppose the first line is indented by four spaces, and the region begins with the second space (region-beginning is between the first and second space). The indentation that must be added to all lines after the first one is four spaces, but for the first line, one space was outside the region and was therefore not removed by ceylon.formatter, so only three spaces need to be added to that line. Part of #8.
lucaswerkmeister
added a commit
that referenced
this issue
May 13, 2017
And also ceylon-format-region-or-buffer, which formats either the region or the buffer and is the new keybinding for formatting. Part of #8.
This was referenced May 13, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pipe it through
ceylon format --pipe
.If
ceylon format
isn’t available, it’s probably better to just bail out rather than install one version fromceylon-mode
, otherwise an outdatedceylon-mode
will install oldceylon.formatter
versions.The text was updated successfully, but these errors were encountered: