Other view file extensions

I'm working in a project with mustache views (*.mustache).  The views are in standard MVC locations but ReSharper isn't smart enough to look for that file extension.  It would be nice if it could for two reasons: so they don't show up as nasty red errors and so I could just ctrl+click on the View function and jump to the view!

I poked around in settings a little but I came up empty.  Is there a way to make ReSharper recognize this other file extension?


Comment actions Permalink
It looks like you can write a small plugin that simply implements the IMvcViewResolver, and is marked with the MvcViewResolver attribute. You just need to implement IsApplicable, to check if mustache files can be used in this project (perhaps check for the mustache assembly?) and then return a dictionary of location types (area, partial, master, etc) to location format strings (e.g. "~\Views\{1}\{0}.mustache"). You can see a simple example by opening the ReShaprer bin directory in dotPeek and finding the MvcViewSparkResolver class.
Comment actions Permalink

Thanks, Matt.  I created one and submitted it:


Please sign in to leave a comment.