4 Replies Last post: Feb 17, 2010 1:04 AM by Matt Ellis  
Matt Ellis Newbie 13 posts since
Jul 5, 2009
Currently Being Moderated

Jan 16, 2010 2:09 AM

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

Slava.Trenogin Novice 91 posts since
Apr 2, 2009
Currently Being Moderated
Jan 19, 2010 2:07 AM in response to: Matt Ellis
Re: Problems integrating Spark MVC references

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.

 

Slava.Trenogin Novice 91 posts since
Apr 2, 2009
Currently Being Moderated
Feb 9, 2010 8:25 PM in response to: Matt Ellis
Re: Problems integrating Spark MVC references

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?

 

More Like This

  • Retrieving data ...