You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Hi, I am working on this PR jupyterlab/jupyterlab#13093 . There is a need to dynamically update YSyncConfig after the initialization of EditorView. I think ySyncFacet is a nice place to do this. However YSyncPluginValue reads this facet during construction, and caches its value. So changing ySyncFacet after the initialization of EditorView has no effect on YSyncPluginValue.
I am changing ySyncFacet by using CodeMirror compartment.
...
const ySyncFacetCompartment = new Compartment();
...
this._editor = Private.createEditor(
host,
fullConfig,
this._yeditorBinding,
this._editorConfig,
[
this._markField,
Prec.high(domEventHandlers),
updateListener,
translation,
// might need some precedence setup here.
ySyncFacetCompartment.of(
ySyncFacet.of(
new YSyncConfig(
this._yeditorBinding?.text,
this._yeditorBinding?.awareness
)
)
),
]
);
...
// every time the model is switched, we need to re-initialize the editor binding
this.model.sharedModelSwitched.connect(() => {
this._initializeEditorBinding();
// it does change ySyncFacet. However YSyncPluginValue already cached old value.
this._editor.dispatch({
effects: ySyncFacetCompartment.reconfigure(
ySyncFacet.of(
new YSyncConfig(
this._yeditorBinding?.text,
this._yeditorBinding?.awareness
)
)
)
});
}, this);
...
Describe the solution you'd like
I think just not caching the facet value can solve the problem.
Is your feature request related to a problem? Please describe.
Hi, I am working on this PR jupyterlab/jupyterlab#13093 . There is a need to dynamically update
YSyncConfig
after the initialization of EditorView. I thinkySyncFacet
is a nice place to do this. HoweverYSyncPluginValue
reads this facet during construction, and caches its value. So changingySyncFacet
after the initialization of EditorView has no effect onYSyncPluginValue
.I am changing
ySyncFacet
by using CodeMirror compartment.packages/codemirror/src/editor.ts
Describe the solution you'd like
I think just not caching the facet value can solve the problem.
Describe alternatives you've considered
No
Additional context
jupyterlab/jupyterlab#13093
The text was updated successfully, but these errors were encountered: