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

Update for compatibility with Atom 1.23 #1017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maxbrunsfeld
Copy link

👋 @david-driscoll, Thanks for maintaining this package!

In Atom 1.23, we'll be making a breaking change to the behavior of the TextBuffer.onWillChange method: an event object will no longer be passed to the method's callback. For a description of the change, see atom/text-buffer#270.

The Breaking API Change

The reason that we're making this breaking change is that the .onWillChange method has been a source of performance problems in Atom when making many simultaneous changes to a buffer, for example when typing with many cursors. The problem is that the method used to get called once for each individual buffer change, which would result in a lot of computation per keystroke.

Now, we only call the onWillChange callbacks once for each buffer transaction (a grouping of changes that can be undone and redone as an atomic unit). Because of this, there is no longer a single oldRange and newRange associated with the call.

The Fix to Your Code

You should be able to simply use the TextBuffer.onDidChangeText method instead. This method calls its callback at the end of a transaction instead of the beginning, so it is able to provide information about each change that occurred.

I apologize to you for not providing backwards-compatibility in this case. Because there were so few (~4) packages that use the .onWillChange method, we chose to just reach out to package maintainers individually, rather than trying to somehow keep old code working.

@maxbrunsfeld maxbrunsfeld changed the title Use onDidChangeText instead of onWillChange Update for compatibility with Atom 1.23 Oct 31, 2017
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.

1 participant