OmniSharp / omnisharp-atom

Omnisharp support for the atom editor
https://atom.io/packages/omnisharp-atom
MIT License
318 stars 61 forks source link

Update for compatibility with Atom 1.23 #1017

Open maxbrunsfeld opened 6 years ago

maxbrunsfeld commented 6 years ago

:wave: @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.