Skip to content

Commit 0010b40

Browse files
BillWagnerCopilot
andauthored
Add and consolidate error codes related to string literals (#49049)
* Incorporate existing content Consolidate existing errors and warnings into the consolidated file. * Additional consolidation Search the roslyn source for related error codes. * Create combined sections. Combine existing content into themes. * I hate YAML * Final proofread and update prompts. * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent aabadc1 commit 0010b40

File tree

9 files changed

+252
-259
lines changed

9 files changed

+252
-259
lines changed
Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,46 @@
11
# Copilot prompts to consolidate error codes.
22

3+
We're going to edit this file, string-literal.md, to contain information about all errors and warnings related to string and character literal declarations. I'll write prompts for specific tasks. Don't make any edits yet. In future prompts, the destination for new error and warning content is always this file.
4+
5+
36
## Add a single existing file into the new consolidated article.
47

5-
Add the contents of cs1027.md to the preprocessor-errors.md file, sort that file by 'source_path_from_root'. Add a redirection for cs1027.md to point to preprocessor-errors.md, add "cs1027: to the list of display names in the TOC for preprocessor-errors.md. Finally, delete cs1027.md
8+
Start with CS1009.md as the source file.
9+
For each source file:
10+
11+
- Add the contents of the source file to the destination.md file.
12+
- Include the source error code in the YML header for `f1_keywords` and `helpviewer_keywords`.
13+
- Add an entry with an anchor for the error error code and its corresponding error message.
14+
- Add the contents of the source file as a new H2 in the destination file.
15+
- Add a redirection for the source file in the file `.openpublishing.redirection.csharp.json`. Make the destination point to destination file. Place the new entry in sorted order based on 'source_path_from_root'.
16+
- Update the TOC file:
17+
- Add the error code to the list of display names in the TOC for the destination file, sorted by numeric error code.
18+
- Remove the TOC entry for the source file.
19+
- Finally, delete the source markdown file.
620

721
## Search for other related articles that may be missed.
822

9-
Search all files in the docs/csharp/language-reference/compiler-messages and the docs/csharp/misc folder for any other errors and warnings that involve preprocessor tokens. Give me a list to review for possible additional consolidation.
23+
Search all files in the docs/csharp/language-reference/compiler-messages and the docs/csharp/misc folder for any other errors and warnings that involve string literals or constants. Give me a list to review for possible additional consolidation.
1024

1125
## Final search in roslyn source
1226

13-
To make sure you've found all related errors, we'll check the source. Look in `CSharpResources.resx` for any elements where the `<value>` element is a message related to preprocessor tokens. The symbolic constant for that value is in the `name` attribute on the parent `data` element. Find that value in `ErrorCodes.cs`. It will map to the compiler error code, where the code is "CS" followed by the number as a four digit number. Build a list of any not already added to preprocessor-errors.md
27+
To make sure you've found all related errors, we'll check the source. Look in `CSharpResources.resx` for any elements where the `<value>` element is a message related to preprocessor tokens. The symbolic constant for that value is in the `name` attribute on the parent `data` element. Find that value in `ErrorCodes.cs`. It will map to the compiler error code, where the code is "CS" followed by the number as a four digit number. Build a list of any related errors, but don't make any edits yet.
28+
29+
For each new file:
30+
31+
- Add the new error code to the front matter of the consolidated article, for both the `f1_keywords` and `helpview_keywords` table.
32+
- Add the new error code and error message to the table at the top of the destination article.
33+
- Add the new error code to the list of `displaName` elements in the TOC file.
34+
- Remove the new error code from the front matter in the file `csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-errors.md` file.
35+
36+
Note that no redirections need to be added for these error codes.
1437

1538
## Build consolidated sections
1639

17-
Examine the highlighted section. Other H2s with similar themes should be combined in a similar format. The recommendations to fix the errors should point to language reference articles that explain the impacted syntax.
40+
For all remaining work, all edits will be in the `string-literal.md` file. The final format should mirror the structure of the `preprocessor-errors.md` file. Every H2 is a theme, all anchors are for the theme, not an individual error code.
1841

19-
To do that, make a new H2 section for the theme. Remove all the H2s for the individual error codes that are part of that theme. Where applicable, the new H2 can include text or examples from the H2s you remove.
42+
To do that, make a new H2 section for the theme. Remove all the H2s for the individual error codes that are part of that theme. Where applicable, the new H2 can include text or examples from the H2s you remove. The new section should include links to language reference articles that discuss the feature or theme.
2043

2144
The list of errors at the top of the file should remain in numerical order, so it's easy for readers to scan. Each impacted error code should now have a link to the anchor tag for the new section. Repeat the list in the new section, but without the anchors, as shown in the highlighted text.
2245

23-
Start with CS1024 and other errors that indicate "Not a valid preprocessor directive"
46+
Start with the section for all errors related to raw string literals.

.openpublishing.redirection.csharp.json

Lines changed: 75 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -355,18 +355,6 @@
355355
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0260.md",
356356
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
357357
},
358-
{
359-
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1112.md",
360-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
361-
},
362-
{
363-
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
364-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
365-
},
366-
{
367-
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1691.md",
368-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
369-
},
370358
{
371359
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0270.md",
372360
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
@@ -403,23 +391,46 @@
403391
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0854.md",
404392
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
405393
},
394+
{
395+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1009.md",
396+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
397+
},
406398
{
407399
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1019.md",
408400
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
409401
},
402+
{
403+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1029.md",
404+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
405+
},
410406
{
411407
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1063.md",
412408
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
413-
414409
},
415410
{
416411
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1067.md",
417412
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-types"
418413
},
414+
{
415+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1112.md",
416+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
417+
},
419418
{
420419
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1501.md",
421420
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
422421
},
422+
{
423+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md",
424+
"redirect_url": "/dotnet/csharp/misc/cs1503"
425+
},
426+
{
427+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
428+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
429+
},
430+
{
431+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1691.md",
432+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
433+
},
423434
{
424435
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1704.md",
425436
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
@@ -1622,10 +1633,6 @@
16221633
"source_path_from_root": "/docs/csharp/misc/cs0282.md",
16231634
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
16241635
},
1625-
{
1626-
"source_path_from_root": "/docs/csharp/misc/cs0501.md",
1627-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
1628-
},
16291636
{
16301637
"source_path_from_root": "/docs/csharp/misc/cs0400.md",
16311638
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
@@ -1650,6 +1657,10 @@
16501657
"source_path_from_root": "/docs/csharp/misc/cs0466.md",
16511658
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/params-arrays"
16521659
},
1660+
{
1661+
"source_path_from_root": "/docs/csharp/misc/cs0501.md",
1662+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
1663+
},
16531664
{
16541665
"source_path_from_root": "/docs/csharp/misc/cs0514.md",
16551666
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/constructor-errors#static-constructors"
@@ -1830,6 +1841,18 @@
18301841
"source_path_from_root": "/docs/csharp/misc/cs0839.md",
18311842
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/parameter-argument-mismatch"
18321843
},
1844+
{
1845+
"source_path_from_root": "/docs/csharp/misc/cs1007.md",
1846+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
1847+
},
1848+
{
1849+
"source_path_from_root": "/docs/csharp/misc/cs1011.md",
1850+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
1851+
},
1852+
{
1853+
"source_path_from_root": "/docs/csharp/misc/cs1012.md",
1854+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
1855+
},
18331856
{
18341857
"source_path_from_root": "/docs/csharp/misc/cs1016.md",
18351858
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/parameter-argument-mismatch"
@@ -1854,10 +1877,6 @@
18541877
"source_path_from_root": "/docs/csharp/misc/cs1028.md",
18551878
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
18561879
},
1857-
{
1858-
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1029.md",
1859-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1860-
},
18611880
{
18621881
"source_path_from_root": "/docs/csharp/misc/cs1030.md",
18631882
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
@@ -1871,35 +1890,11 @@
18711890
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
18721891
},
18731892
{
1874-
"source_path_from_root": "/docs/csharp/misc/cs1040.md",
1875-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1876-
},
1877-
{
1878-
"source_path_from_root": "/docs/csharp/misc/cs1517.md",
1879-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1880-
},
1881-
{
1882-
"source_path_from_root": "/docs/csharp/misc/cs1560.md",
1883-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1884-
},
1885-
{
1886-
"source_path_from_root": "/docs/csharp/misc/cs1576.md",
1887-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1888-
},
1889-
{
1890-
"source_path_from_root": "/docs/csharp/misc/cs1578.md",
1891-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1892-
},
1893-
{
1894-
"source_path_from_root": "/docs/csharp/misc/cs1633.md",
1895-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1896-
},
1897-
{
1898-
"source_path_from_root": "/docs/csharp/misc/cs1634.md",
1899-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1893+
"source_path_from_root": "/docs/csharp/misc/cs1039.md",
1894+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
19001895
},
19011896
{
1902-
"source_path_from_root": "/docs/csharp/misc/cs1635.md",
1897+
"source_path_from_root": "/docs/csharp/misc/cs1040.md",
19031898
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
19041899
},
19051900
{
@@ -1930,10 +1925,6 @@
19301925
"source_path_from_root": "/docs/csharp/misc/cs1106.md",
19311926
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
19321927
},
1933-
{
1934-
"source_path_from_root": "/docs/csharp/misc/cs1007.md",
1935-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
1936-
},
19371928
{
19381929
"source_path_from_root": "/docs/csharp/misc/cs1109.md",
19391930
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
@@ -1946,18 +1937,26 @@
19461937
"source_path_from_root": "/docs/csharp/misc/cs1113.md",
19471938
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
19481939
},
1949-
{
1950-
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md",
1951-
"redirect_url": "/dotnet/csharp/misc/cs1503"
1952-
},
19531940
{
19541941
"source_path_from_root": "/docs/csharp/misc/cs1510.md",
19551942
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/ref-modifiers-errors"
19561943
},
1944+
{
1945+
"source_path_from_root": "/docs/csharp/misc/cs1517.md",
1946+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1947+
},
19571948
{
19581949
"source_path_from_root": "/docs/csharp/misc/cs1529.md",
19591950
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/using-directive-errors"
19601951
},
1952+
{
1953+
"source_path_from_root": "/docs/csharp/misc/cs1534.md",
1954+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
1955+
},
1956+
{
1957+
"source_path_from_root": "/docs/csharp/misc/cs1535.md",
1958+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
1959+
},
19611960
{
19621961
"source_path_from_root": "/docs/csharp/misc/cs1537.md",
19631962
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/using-directive-errors"
@@ -1966,6 +1965,18 @@
19661965
"source_path_from_root": "/docs/csharp/misc/cs1552.md",
19671966
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
19681967
},
1968+
{
1969+
"source_path_from_root": "/docs/csharp/misc/cs1560.md",
1970+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1971+
},
1972+
{
1973+
"source_path_from_root": "/docs/csharp/misc/cs1576.md",
1974+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1975+
},
1976+
{
1977+
"source_path_from_root": "/docs/csharp/misc/cs1578.md",
1978+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1979+
},
19691980
{
19701981
"source_path_from_root": "/docs/csharp/misc/cs1586.md",
19711982
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
@@ -2023,12 +2034,16 @@
20232034
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"
20242035
},
20252036
{
2026-
"source_path_from_root": "/docs/csharp/misc/cs1534.md",
2027-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
2037+
"source_path_from_root": "/docs/csharp/misc/cs1633.md",
2038+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
20282039
},
20292040
{
2030-
"source_path_from_root": "/docs/csharp/misc/cs1535.md",
2031-
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
2041+
"source_path_from_root": "/docs/csharp/misc/cs1634.md",
2042+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
2043+
},
2044+
{
2045+
"source_path_from_root": "/docs/csharp/misc/cs1635.md",
2046+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
20322047
},
20332048
{
20342049
"source_path_from_root": "/docs/csharp/misc/cs1637.md",

0 commit comments

Comments
 (0)