View Plugin vs. State Field for inline replacements with line wrapping


in an extension I want to (visually) replace specific strings with other strings of variable length under certain conditions using replace decorations with an inline widget. When line wrapping is enabled, this could affect vertical space by introducing line breaks.

The docs say clearly that if my decorations affect vertical space, I should use a state field to provide them. However, I find examples of extensions where these kind of replacement decorations are provided from a view plugin (some popular Obsidian plugins do it, where line wrapping is enabled per default).

I would prefer a view plugin for performance. I’d like to understand better why and whether I really need a state field here. Would some slight scrolling issues be the worst I could expect when using a view plugin, or would it be detrimental in other ways?

Appreciating any insight on this!

A plugin is fine there. What those shouldn’t do is change the block structure of the document, i.e. replacing line breaks or adding block widgets. Wrap points are not line breaks.

Ok I see, thanks for the quick and helpful response.