Skip to content

perform in-place delta updates of extension API ExtWindow and ExtCodeEditor

Administrator requested to merge in-place-editor-updates-ext-api into master

Created by: sqs

This allows holders of references to these objects to actually listen for changes, instead of having the objects wiped away.

For example, take CodeEditor#selectionsChanges. Right now, this is defined as public readonly selectionsChanges = of(this._selections), so it only emits once. You can construct an RxJS pipe to make this work as intended (to listen for selections changes), but there are 2 limitations:

  1. If you have const editor = activeWindow.activeViewComponent, then editor.selectionsChanges will get stale when the selection actually changes. You need to use RxJS pipes, which is unintuitive. Authors assume the editor object will be updated in-place.
  2. If there is a more expensive observable, such as editor.visibleRangesChanges (which would rely on a DOM MutationObserver), then you don't want to resubscribe every time any small change is made to the editor (like its content changes).

This addresses those issues without any regressions to existing behavior and makes the extension API work slightly more in line with the author's expectations.

Merge request reports

Loading