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

Add code formatting integration to Elixir cells #416

Merged
merged 1 commit into from
Jul 1, 2021
Merged

Conversation

jonatanklosko
Copy link
Member

Closes #296.

I figured out a way that should overcome the concerns I had with formatting and is actually pretty simple. There is a detailed comment in the code, but the important parts are:

  • user originates the formatting and it happens within editor as a regular edit (consequently it's a normal operation on the undo stack)
  • the formatting operation isn't a replace-all, but a set of operations that introduce the minimal diff, consequently the Delta sent from the client is reasonable, which should make conflict resolution work reliably if needed
  • formatting is only applied if the editor is intact, any change (remote or local) cancels the formatting, and that eliminates a whole category of conflicts
editor_formatting.mp4

},
%{
seq: ["ctrl", "shift", "i"],
seq_mac: ["⇧", "⌥", "f"],
Copy link
Member Author

@jonatanklosko jonatanklosko Jun 30, 2021

Choose a reason for hiding this comment

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

@josevalim please verify that this works as expected for you and if you can undo the formatting edit :)

@benjreinhart
Copy link
Contributor

@jonatanklosko it works for me on Mac

@jonatanklosko jonatanklosko merged commit 86316e9 into main Jul 1, 2021
@jonatanklosko jonatanklosko deleted the jk-formatting branch July 1, 2021 09:50
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.

Format Elixir cells
3 participants