Automated Refactorings / Updating references


I want to build a (semi-) structured for end users. For the sake of the example, I use a regular program. Imagine the following program: def add(a, b): a + b

Imagine the user now wants to rename the parameter ‘a’ i would like to implement a functionality that automatically renames the reference in the plus-expression as well.

I wonder how I could implement such a functionality? I was thinking about creating a schema for the Parameter that contains an ID and the ParameterReference pointing to that. Would that be a good approach?

I have similar use cases when I show only a partial document. One example would be a reference to chapter marks. Imagine I have a document with chapters and references to those. If i rename the chapter, the references should also be updated. The chapter that is referenced is not necessarily not visible in the current editor. If I rename the chapter, the chapter reference should be updated the next time it is displayed.

Has anyone else attempted to build a structured editor with prosemirror? In the search, I found one thread, but it was more a general discussion about structured editors.

Thanks in advance!

Hi Bernd, what we do in SciFlow is storing an ID attribute (see here) in all block nodes (paragraphs, headings, figures, etc.) and then cross-reference those. As long as the user doesn’t completely delete the node the reference will stay intact even if the text content changes.

Other than that, I am unsure what you mean by structured. Is there something else than cross-references?



1 Like