Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-205200: Suggest Context Action for formatting inside String.Format calls

$
0
0
Reporter Omer Raviv (OmerRaviv) Omer Raviv (OmerRaviv)
Created Jan 18, 2011 3:22:46 PM
Updated Apr 10, 2018 1:31:54 PM
Subsystem Context Actions
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Submitted
Type Feature
Fix version Backlog
Affected versions 2018.1
Fixed In Version ReSharper Undefined
VsVersion All Versions
In the following code:

 return String.Format("A: {0} B: {1} C: {2} D: {3} E: {4}", myInt, myDouble, myDateTime, myTimeSpan, myString)
;

There shall be different Context Actions on each "{X}" part, suggesting the most popular custom formatting option for the appropriate type.

For example, if the placeholder is for a DateTime, these will be some of the suggested Context Actions:

Use "MM/dd/yyyy" format specfier, as in: 03/09/2008
Use "M/d/yyyy" format specfier, as in: 3/9/2008
Use "ddd, MMM d, yyyy" format specfier, as in: Sun, Mar 9, 2008


As an added bonus, the last Context Actions could be: "Show DateTime Format Specifier CheatSheet" which would pop up a documentation window (as in when you press Ctrl+Shift+F1), which would give you the complete documentation of format specifiers (not just the most popular).

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>