Extend PathReferenceAttribute to include a base path
Short version:
Would it be possible to extend the PathReferenceAttribute to include a base path, like [PathReference("~/Scripts")]
Long version:
I have just started using the PathReferenceAttribute from the JetBrains.Annotations assembly. It's a really nice way to annotate your parameters, to express the intentions. However, the PathReferenceAttribute seems to be missing a rather important property - "BasePath". In MVC for instance, there seems to be a convention of always putting your scripts in the "/Scripts/" folder.
I have created an extensionmethod on the HtmlHelper class, to add scripts to my views like this: Html.Script("myscript.js").
Since I always put my scripts in the "/Scripts/"-folder, the extensionmethod automatically adds "~/Scripts/" to filepath, which helps me reduce typing errors in the "~/Scripts/" part og the path.
The problem is just that ReSharper doesn't recognise the path, unless I provide it with the full or virtual path. If I write "~/Scripts/myscript.js" ReSharper picks up the path correctly, but without the base path, it can't (for obvious reasons).
I thought about extending the attribute myself, but there is nothing to extend :(
Thanks,
Kenneth
Please sign in to leave a comment.
Thanks Kenneth for suggestion.
It's logged http://youtrack.jetbrains.net/issue/RSRP-214492
We'll try to include this request in upcoming 6.0 release.
WBR, Slava.