-
Notifications
You must be signed in to change notification settings - Fork 6
Support standard and custom ViewLocationConventions #28
Comments
This is a great idea, and you're right, this would solve #4 as well, however I don't immediately see how this would be possible. ReSharper's analysis depends on things that can be statically resolved (or at least, guessed), and those conventions are not resolved until runtime. I'll try to play around with the idea. Basically, defining custom (static) conventions is easy, i.e. supporting "~/Features/ViewName.cshtml" can be done even today (just need to modify an xml file). I might have an idea how it's possible to solve this, but I'll need to spike it. Stay tuned :) |
Btw, just to make sure, in your convention, did you intend to concat "Features" with the module path? Or are you missing a "/" in there? (not that it matters, just making sure) |
You're right...I was missing the "/". |
I should mention, though, that this is still a work in progress. As of right now, I have these three conventions:
This allows me to completely avoid typing the word "Features" when specifying a view location. |
I'm thinking, that as a preliminary step, there could be some special "metadata", perhaps a custom attribute or a specially-formatted comment, so the plugin could pick it up and added to the ViewLocationFormats collection. |
I don't know the first thing about writing a ReSharper plug-in, but if you can point me to the relevant code files(s), I'd like to take a look at how it works now. Maybe it will spark an idea. |
I wish it was that easy, I have no idea myself. I'm going to bug the guy responsible for ASP.NET MVC in R#, maybe he could hint as to how (and if) this is possible :) |
Oh okay :) I'll keep my fingers crossed that there's a way (and that it's not too hard). |
I'm not sure if this is feasible, but it would be extremely cool to have support for the entire array of ViewLocationConventions configured in the Nancy bootstrapper.
For example, I was trying to organize my project by feature. This is similar to the Module Path Convention, except all the module folders are combined into a single folder called "Features".
I was able to implement this quite easily by creating the following override to ApplicationStartup:
This seems to work well so far, except ReSharper now thinks all my view names are wrong. If there were some way to have ReSharper actually perform the same logic as Nancy when evaluating view names, it would be a great enhancement. I believe it would also solve #4.
The text was updated successfully, but these errors were encountered: