Commit bce623e
authored
Describe UnitsNet.Modular numeric format strings (#1716)
## Motivation
UnitsNet.Modular forwards quantity format strings such as `F1` to the
stored numeric value, but its public APIs do not currently identify
those parameters as numeric format strings to IDE tooling.
## Changes
- annotate generated quantity `ToString(string)` overloads with
`StringSyntaxAttribute.NumericFormat`
- annotate the type-erased `IQuantityDescriptor.Format` format parameter
- verify the annotations are present in emitted consumer-visible
metadata
This improves validation and completion for direct format-string
arguments where supported by the IDE. Interpolation clauses such as
`$"{speed:F1}"` continue to work, but their completion behavior remains
controlled by the IDE's interpolated-string support.
## Validation
- `dotnet test UnitsNet.Modular/UnitsNet.Modular.slnx --no-restore -m:1
-p:UnitsNetModularSampleUpdateLocalPackagesOnBuild=false`
- 115 tests passed
- Modular runtime built for .NET 8, .NET 9, and .NET 101 parent 5aad11f commit bce623e
3 files changed
Lines changed: 31 additions & 2 deletions
File tree
- UnitsNet.Modular
- UnitsNet.Modular.Generator
- UnitsNet.Modular.Tests
- UnitsNet.Modular/Metadata
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
222 | 226 | | |
223 | 227 | | |
224 | 228 | | |
225 | | - | |
226 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
227 | 236 | | |
228 | 237 | | |
229 | 238 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
13 | 32 | | |
14 | 33 | | |
15 | 34 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
0 commit comments