Skip to content

Preserve indentation when formatting selection#113

Merged
CiGit merged 2 commits intoprettier:masterfrom
josephfrazier:cursor
Jun 2, 2017
Merged

Preserve indentation when formatting selection#113
CiGit merged 2 commits intoprettier:masterfrom
josephfrazier:cursor

Conversation

@josephfrazier
Copy link
Copy Markdown
Contributor

This fixes #109 by using
the new rangeStart and rangeEnd options in Prettier v1.4.0 (see here
for details: prettier/prettier#1609)

This fixes prettier#109 by using
the new `rangeStart` and `rangeEnd` options in Prettier v1.4.0 (see here
for details: prettier/prettier#1609)
fullDocumentRange(document),
format(document.getText(), document.fileName, {
rangeStart: document.offsetAt(range.start),
rangeEnd: document.offsetAt(range.end)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahah. That was the range to 0 based function you told me in your PR 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, and there's also positionAt for going the other way.

@CiGit CiGit merged commit a5b7b3c into prettier:master Jun 2, 2017
@CiGit
Copy link
Copy Markdown
Member

CiGit commented Jun 2, 2017

I should use the word soon more often #109
(I was following prettier/prettier#1609 with attentions)
Thanks!

@josephfrazier josephfrazier deleted the cursor branch June 2, 2017 22:04
@josephfrazier
Copy link
Copy Markdown
Contributor Author

Haha, thanks for the quick merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breaks indentation when formatting only selection

2 participants