I've been trying to use ReSharper's search with pattern tool to append a [UriSample]
to each endpoint using the existing [Route]
prefix. This currently does not replace anything:
Search Pattern:
[Route($route$)]
[Obsolete($obsolete$)]
replace Pattern:
[Route($route$)]
[Obsolete($obsolete$)]
**[UriSample("devices/$route$")]**
I've looked at a lot of documentation but it seems like I can not find a solution to this. Thank you for the help :)
** it usually says "Pattern is unambiguous" **
This is a current limitation of this system. It's made to perform syntactic changes on your code, and it doesn't support symbolic operations for now.
In your case Visual Studio Find and Replace dialog will help. You can use this pattern to look for the attribute:
\[Route\(\"(.+?)\"\)\]
And this one for replace action:
[Route("$1")]\n[UriSample("devices/$1")]
After the replacement just execute formatting action to fix any layout issues according to your project settings.
Before:
After:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.