Problems integrating Spark MVC references

Hello. I've been playing with getting some support for .spark files into the ReSharper 5 beta. I created a reference provider that would treat spark files as the target of references for views. This works very nicely when ctrl-clicking a View(); method in a controller action - it finds the associated <action>.spark file and opens it up a treat.

Things don't work so well when specifying a view by name in a string literal e.g View("Index").

I can ctrl-click the string and again get navigated to the Index.spark file, but it also gets highlighted as unresolved - the string appears in red and the tooltip says "Cannot resolve view 'Index'". And intellisense within the string works a bit oddly - I just get a list of available .spark files, but not .aspx or .ascx files.

I've had a dive through the code and figured out what was going on.

The string literal is getting multiple references associated with it - mine, and one from the standard aspx based MVC reference provider. Mine is saying that it's resolved, hence the underline and the ctrl-click, but the standard MVC reference is of course undefined (because there's no associated aspx file).

And the intellisense provider only gets candidates from the first completable reference it finds, which is my spark one. This makes sense - intellisense normally completes from a single reference (such as a variable), but it does mean that it doesn't include any .aspx files.

So, I guess I'm asking if this can be fixed in a future build? Can the intellisense code combine the references? Is there anything that can be done to prevent the multiple references of the view name string literal? I'd love to get some first class spark support (I'm revving myself up for a full on language service...)

Thanks
Matt

4 comments
Comment actions Permalink

Matt Ellis wrote:

Hello. I've been playing with getting some support for .spark files into the ReSharper 5 beta. I created a reference provider that would treat spark files as the target of references for views. This works very nicely when ctrl-clicking a View(); method in a controller action - it finds the associated <action>.spark file and opens it up a treat.
Things don't work so well when specifying a view by name in a string literal e.g View("Index").
I can ctrl-click the string and again get navigated to the Index.spark file, but it also gets highlighted as unresolved - the string appears in red and the tooltip says "Cannot resolve view 'Index'". And intellisense within the string works a bit oddly - I just get a list of available .spark files, but not .aspx or .ascx files.
I've had a dive through the code and figured out what was going on.
The string literal is getting multiple references associated with it - mine, and one from the standard aspx based MVC reference provider. Mine is saying that it's resolved, hence the underline and the ctrl-click, but the standard MVC reference is of course undefined (because there's no associated aspx file).
And the intellisense provider only gets candidates from the first completable reference it finds, which is my spark one. This makes sense - intellisense normally completes from a single reference (such as a variable), but it does mean that it doesn't include any .aspx files.
So, I guess I'm asking if this can be fixed in a future build? Can the intellisense code combine the references? Is there anything that can be done to prevent the multiple references of the view name string literal? I'd love to get some first class spark support (I'm revving myself up for a full on language service...)


Hi Matt!

Since ASP.NET MVC framework is extensible we need to do our MVC support also extensible, so you can write resharper
plugign to resolve references to spark files during our resolving. I mean not general ReSharper plugin, but plugin for
specific feature, MVC here. Due lack of time we can't promise it to release 5.0 (in MVC more important to support areas
now). In meantime, you can just disable general MVC support in ReSharper options.

Anyway, thank you for your great job with spark support. We will try to add extension points in our MVC support as soon
as we can, worst case - next minor release after 5.0.

0
Comment actions Permalink

Excellent news! And fingers crossed it'll make 5.0...

0
Comment actions Permalink

Matt Ellis wrote:

Excellent news! And fingers crossed it'll make 5.0...


Hi Matt!
Can you point me out, where are sources for your R# plugin for spark?

0
Comment actions Permalink

Sorry I didn't reply sooner - I had to update it to get it to compile again after you guys added MVC 2 Areas support. It's currently a simple plugin, based very much on the code for the C# MVC reference provider. I haven't tested it against areas yet, but it does work when ctrl-clicking the view name in the controller, and it does appear in intellisense for view files.



Attachment(s):
ReSparker.zip
0

Please sign in to leave a comment.