Posted 12 years ago by Alex
Avatar
I’ve been playing with the new version and it is really amazing. Thanks for the great product.
I understand that I can add assembly references to DotNetProjectResolver and it will provide me intellisense support for the types from this assembly. But in my case I have several files, each of them defining a separate class. How can I use the type information from these different files for intellisense, so it works like Visual Studio? Of course, I can compile it to assemply and use it as reference, but is there any other way?
Actually, in my case I already have a CodeDomCompiledUnit for these class , if it makes a task easier.

Thanks,
Alex

Comments (10)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alex,

You'd want to queue up a bunch of semantic parse requests to the semantic parser service. One request for each document that isn't open in a SyntaxEditor. Make the request a low priority so that SyntaxEditor editing can take precedence. The Document Outline QuickStart shows how to do this sort of thing but for one document.

When you get the results you'll have to update the SourceProjectContent on the DotNetProjectResolver with the compilation units that you receive. After you do that, everything will be set up for IntelliPrompt on those files.

Post if you have any questions or implementation tips for other customers. Maybe we can add a QuickStart that shows this.


Actipro Software Support

Posted 12 years ago by Alex
Avatar
Thanks for the reply. I followed your advice and have a next question.
The SourceProjectContent needs a IDomType, so how can I convert the ICompilationUnit to IDomType. Is there an API for that or I should do it manually iterating through nodes?
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You would do this:
dotNetProjectResolver.Clear(filename);
dotNetProjectResolver.AddRange(filename, compilationUnit.Types);
That should do it.


Actipro Software Support

Posted 12 years ago by Alex
Avatar
Thanks, it works like a charm - excellent tool!
Here is my code
CompilationUnit compilationUnit = (CompilationUnit)request.SemanticParseData;
string key = request.Filename;
dotNetProjectResolver.SourceProjectContent.Clear(key);
dotNetProjectResolver.SourceProjectContent.AddRange(key, compilationUnit.Types);

I found one small problem with IntelliPrompt for nested classes. Here is a snippet to show it

class Test1
{
public Test1()
{
Test2 t; // IntelliPrompt doesn't work
Test1.Test2 t2; // IntelliPrompt works

}

class Test2
{
public string Value;
}
}
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alex,

For the final 4.0 release which should be very soon, we wrapped all the code you had to implement to do this into a single call like this:
dotNetProjectResolver.SourceProjectContent.LoadForFile(language, filename);
So when loading a "project" in your app, you would just call the new LoadForFile method for each code file and you don't have to do anything else. Good stuff!

Thanks for the bug report... we'll check it out.


Actipro Software Support

Posted 12 years ago by Alex
Avatar
Thanks, it would be great addition!

In reality I have sort of MDI application with several documents (source codes). Each time user changes one document and switches to another I will have to refresh ProjectContent. So would it be possible to add a function like

dotNetProjectResolver.SourceProjectContent.LoadForCode(language, string code, string key)?

Of course, I can flush the code into the file, but it looks like an unnecessary step

Alex
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Actually, in the latest beta, if you are editing those documents with SyntaxEditor then the source is updated automatically. So you shouldn't have to load the code yourself.

You can see this in action in the .NET Reflection QuickStart where it demos two open documents that both know about the reflection data of the other.


Actipro Software Support

Posted 12 years ago by Alex
Avatar
Actually, in my case, I have only one document edited with SyntaxEditor. All other source code documents I create on a fly using CodeDOM
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I see... LoadForCode is now implemented as well.


Actipro Software Support

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alex,

The nested class bug is now fixed for the next maintenance release.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.