- Written by Fabrice
- Created: 11 January 2017
This is a question, a lot of you are asking when they start the current version of Visual Studio Integration of XSharp; and I think you must have some explanations about it.
First, Intellisense is maybe not the right term to use, because it does cover a lot of features: So, you will have to make the distinction between Autocompletion, Parameters tooltips, Goto entity, Peek definition, Code snippets, …
And unfortunately, all that doesn’t comes automatically in VS : we have to provide the services.
Most of that was done by a LanguageService in VisualStudio, prior the 2015 version; but since then, when you look at the MSDN documentation, it is now related as legacy. Most of all, the vNext generation of Visual Studio is also introducing a new way of managing the project system, and in order to keep in touch with right technology, we must now implement these features as MEF.
MEF, the Managed Extensibility Framework, is feature introduced with .NET 4.0 that allows you to Import or Export classes as a provider, and have these automatically used by the consumer: Here, Visual Studio.
Ok, very interesting but Where is my Intellisense ?
Not too far, in fact : In order to provide Autocompletion, we must know what you are typing, in which context. So we need load references of your project and (using reflection) extract all information (Class/Method/Property/Parameters/…), then walk all your source code, and build a database of Elements using the XSharp compiler.
By the way, one element is how the Database is built : C++ is using an external database using SQLite, C# is using an In-Memory model, so we have to deal with speed and memory usage : We currently have made the choice to also have an In-Memory model, but may reconsider that if some users are running low on memory with big projects.
Creating and managing that was a bit long, but we now have a strong model and the first step will be soon available.
Yes we will also (try to) do CodeLens. But that is not on the top of the list. Codecompletion (list members), parameter tips and code snippets come first.
And then of course: goto definition, Quick Info, Word completion, case synchronization , Find References, object browser, class browser, and maybe also showing the classes in a prg file as child of the file nodes in the solution explorer.
But all of these require that we have a correct and complete object model of the (uncompiled) code in the solution as well as proper meta data from the referenced assemblies.
That is what we have at this moment. The rest builds on top of this. And the good thing is that we have done it before and that VS has changed, so things like this are easier to implement then when we started with Visual Studio 2003 many moons ago.
And we also have the C# implementation of these features (this is part of Roslyn too) so we can see how it is supposed to be done.
Just curious: Are Intellisense and CodeLens directly connected, or does it takes extra effort to implement CodeLens?