views:

333

answers:

2

I'm creating a little special purpose view engine for asp.net mvc. That goes well enough. But i've been looking around to find information on how to somehow add intellisense for the C# code embedded in my view.

I can see Spark does that, but going through the sources, I still can't see how. And WebForms view engine does it - not surprisingly - to perfection. Does anyone have any suggestions or links or anything related on how to do that?

Update: Just to let readers know, I'm still looking for a solution! So keep the answers coming :) ... I will post back here too, whenever I find out more.

/Asger

+2  A: 

You might find some clues here:

http://stackoverflow.com/questions/811905/how-do-i-add-intellisense-to-my-application

Googling this is maddeningly difficult, as you get all kinds of hits on enabling intellisense, how wonderful intellisense is, how bad intellisense is, etc.

Robert Harvey
That is indeed very difficult, I've been trying for hours :)Thank you very much for the link! All the posts seems to be dealing with how to implement it out of VS scope, but it might be, that the way to do it, is to write it, and then hook into the VS editor with your own implementation. But it does seem to me though, that Spark is using the native intellisense - I really do wonder how.
asgerhallas
+3  A: 

Looking at the Spark source, it appears that he is hosting his editor within the Visual Studio 2008 IDE, in a way that he is getting the C# intellisense for free.

You might want to check out the Visual Studio 2008 SDK 1.1, and see if there's something in there that will help you.

http://www.microsoft.com/downloads/details.aspx?familyid=59EC6EC3-4273-48A3-BA25-DC925A45584D&displaylang=en

Robert Harvey
Thank you! But where in the Spark sources is it done? I really can't find it :)I'll check out the SDK to see if that helps!
asgerhallas
And one thing I really wonder, is even if he manages to have native intellisense from the editor - how do one define the which scope the written code is in?
asgerhallas
Ah now I see. It seems to be in the Tools folder in an "installer solution". Now I might begin figuring this out :)
asgerhallas
I was wondering that myself. The scope also affects the color syntax highlighting; the editor must be flipping a flag as it switches context while looping thru the text, but that's just my guess.
Robert Harvey
A little progress: The name I might be looking for is the IVsIntellisenseProject Interface used with Contained Languages i VS described here: http://msdn.microsoft.com/en-us/library/bb166334(VS.80).aspx, and the creator of Spark rants about the mess here: http://whereslou.com/2008/12/03/ivsintellisenseless
asgerhallas
Here are some more references, unfortunately it states, that there are no examples on how to do "out there": http://social.msdn.microsoft.com/forums/en-US/vsx/thread/c7aa0a2d-862d-4e94-bafa-5450a491419f
asgerhallas