JetBrains / MPS-extensions

MPS-extensions aims to ease language development within MPS.
https://jetbrains.github.io/MPS-extensions/
Apache License 2.0
80 stars 47 forks source link

EscapeSpecialCharactersInProperties enhancement script should not trigger in richtext #767

Open malueck opened 5 months ago

malueck commented 5 months ago

The enhancement script EscapeSpecialCharactersInProperties from jetbrains.mps.lang.smodel shows a note next to any Text node from de.slisson.mps.richtext that happens to contain a linebreak. It suggests "Escape special characters in property values" and will convert all \n to \\n, effectively making the text single-line. It is clear why this suggestion exists, but clearly richtext is designed to exactly deal with the issues of linebreaks, so the message is confusing end users.

There is a MultilineUtil class as part of the plugin that does the escaping for the backing property of Word, but its code has been removed for a while now? At the moment it seems to do nothing.

It seems the only workaround is to clone the Word concept and re-implement the escaping, but this would be lots of pain since large parts of the plugin work with explicitly the Word (not IWord) concept and we would lose much of the functionality like normalization. Is there any other way to get rid of the enhancement script or to change the way how Word stores its text in a property? Thanks!

alexanderpann commented 5 months ago

There is nothing we can do on the platform side about the enhancement script. The only thing you can do is click on the arrow right next to the intention and select Disable This Intention. You can re-enable it in preferences-> Editor -> MPS Intentions.

The class MultilineUtil could be removed, this is true. Looking at the history of EscapeSpecialCharactersInProperties  and the comment, I feel like the enhanced script might be deprecated. @artem-tikhomirov you removed the code. Can you maybe comment on that?