I just found out about NRefactory 5, and I would suggest that this is the most suitable solution for my current problem. I am currently developing a small C # scripting application for which I would like to provide code completion. Until recently, I did this using the Roslyn project from Microsoft. But since the last update of this project requires .Net Framework 4.5, I can no longer use this, since I would like the application to run under Win XP. So I have to switch to another technology here.
My problem is not compilation. This can be done with some additional .Net CodeDomProvider efforts. The problem is the content of the code. As far as I know, NRefactory 5 provides everything you need to ensure code completion (parser, type system, etc.), but I just can't figure out how to use it. I took a look at the source code of SharpDevelop, but they do not use NRefactory 5 to complete the code there, they only use it as a decompiler. Since I could not find an example on how to use it to complete code on the network, I thought I could find some help here.
The situation is as follows. I have one file containing the script code. In fact, this is not even a file, but a string that I get from the editor control (by the way: I use AvalonEdit for this. Great editor!) And some assemblies that need to be referenced. Thus, no decision files, project files, etc. Only one line of source code and assembly.
I read the demo that comes with NRefactory 5 and the article on code project, and got up with something like this:
var unresolvedTypeSystem = syntaxTree.ToTypeSystem(); IProjectContent pc = new CSharpProjectContent();
My problem is that I do not know how to do this. Iām not even sure that this is the right approach to achieve my goal. How to use CSharpCompletionEngine? What else is required? etc. You see that a lot is not clear at the moment, and I hope that you can bring light to this.
Thank you all in advance!
source share