views:

462

answers:

2

What we ideally need is, to know how Microsoft handles XAML generated code (Those *.g.cs files). If you goto a XAML code behind, intellisense will work even if the *.g.cs file is not part of the project!!


Context:

In a custom VS package, we need to have some logic to open a CS file (with out making it a part of the project) in the VS IDE, to allow the user to edit it.

We are hooking up the document to the Running document table and receiving the events like Saving, Close and all, using IVSRunningDocumentTable. Works good.

Now the problem is, when the document is opened, Intellisense can't work, for the simple reason that the opened document is not part of the project (sadly, we can't do that, we can't make it code behind).

+3  A: 

Intellisense is driven by a memory cache of identifiers and types. These types are cached based on the project you are in and the references that project has. If the code file you are editing is not part of a project, Visual Studio would have to load every possible assembly and create intellisense data for each type in the entire .NET framework because it would have no way of knowing whether or not your code file required it.

I guess Visual Studio could load intellisense based on the content of the file but that is not the way it currently works.

Andrew Hare
This is perfectly known, thanks though. The question is, is there a way to tie a manually opened document to that cache, as it happens for xaml code behind files.
amazedsaint
A: 

Visual Assist X by Whole Tomato is an addin to VS I've been using for many years. It will give you Intellisense and more when you open it.

Ady Kemp