Skip to content
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

fix: Fix Prettier formatting issues #56

Merged
merged 1 commit into from
Apr 5, 2019
Merged

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented Apr 5, 2019

This PR applies the following fixes:

  • Maintain undo history after formatting.
  • Support formatting within undocked editor.
  • Format current editor value, not last rendered code.

Why were these issues happening?

  • We update the key for the editor when formatting, which causes a remount. This means we're actually rendering an entirely new editor without any undo history.
  • We attach the keyboard shortcut to the window, but not to the new window that gets opened when undocking the editor.
  • We were debouncing the code state update, which means that any attempt to read the current editor value was actually reading a snapshot of the last committed code, not necessarily what the user had most recently typed.

Applies the following fixes
- Maintain undo history after formatting
- Support formatting within undocked editor
- Format current editor value, not last rendered code
@markdalgleish markdalgleish merged commit 9ccae36 into master Apr 5, 2019
@markdalgleish markdalgleish deleted the fix-prettier-issues branch April 5, 2019 00:22
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.

2 participants