Codemirror View Plugin vs. State Field for inline replacements

Hi,

I’m working a plugin that uses a CM editor extension to replace some string with another string as an inline widget in live preview, and I’m unsure whether I should use a State Field or a View Plugin to provide the replacement decorations.

I’m currently using a State Field because the docs say that if the decorations affect vertical space they need to be provided from a state field. The replacement strings can be longer that the original one and contain spaces, so they could affect vertical space through line breaks due to wrapping.

Now I’ve seen that other plugins doing similar things are using a View Plugin (such as dataview’s inline queries in LP). I would like to use a view plugin for performance reasons but as far as I understand the docs, I shouldn’t. Or am I missing something and it would be safe to use a view plugin in my case?