We have replaced our old c# editor with Alternet Editor, and we have one issue that we can’t seem to fix.
In the old editor, we used to address our global variables with a # prefix, e.g., “#NameOfTheVariable”. The old editor will switch out internally the ‘#’ to ‘ _ ’ in the line parse event, and the variable was correctly found without any issues. Since the old editor allowed the ‘#’ to be used in the code without issues this thing has worked for us. But, as we have found out, using the ‘#’ in our text source with Alternet Editor will produce a compilation error. Addressing the variable directly with ‘ _ ’ works without any changes with Alternet editor but this means we must change all the source code where the variables are globally accessed (e.g., search and replace ‘#’ with ‘ _ ’). This is not an option for us, unfortunately, so we are looking for a solution to do it ‘on-the-fly’ like before.
We are currently using the Roslyn Parser for C# (Alternet.Syntax.Parsers.Roslyn.CsParser).
I have tried manipulating the TextSource, for example extending the class and overriding the setter and getter for Lines or Text but then the variable would not be available in the current context for some reason and the error highlighting would not work, example:
This looks like a false way to do it, so I am reaching out to support in hope to not go down a rabbit hole that wouldn’t solve the issue.
Is there any way you see it could work out for us to allow us to use the Alternet Editor but still suppress the ‘#’ compilation issue and resolve the variable internally without modifying the source itself? Can we make this work with the Roslyn Parser, or should we investigate AdvancedParser instead? Is there any other way of doing this that I am unaware?
Thanks in advance!
Best regards