Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions .github/prompts/error-consolidation.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
# Copilot prompts to consolidate error codes.

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.


## Add a single existing file into the new consolidated article.

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
Start with CS1009.md as the source file.
For each source file:

- Add the contents of the source file to the destination.md file.
- Include the source error code in the YML header for `f1_keywords` and `helpviewer_keywords`.
- Add an entry with an anchor for the error error code and its corresponding error message.
- Add the contents of the source file as a new H2 in the destination file.
- 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'.
- Update the TOC file:
- Add the error code to the list of display names in the TOC for the destination file, sorted by numeric error code.
- Remove the TOC entry for the source file.
- Finally, delete the source markdown file.

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

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.
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.

## Final search in roslyn source

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
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.

For each new file:

- Add the new error code to the front matter of the consolidated article, for both the `f1_keywords` and `helpview_keywords` table.
- Add the new error code and error message to the table at the top of the destination article.
- Add the new error code to the list of `displaName` elements in the TOC file.
- 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.

Note that no redirections need to be added for these error codes.

## Build consolidated sections

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.
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.

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.
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.

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.

Start with CS1024 and other errors that indicate "Not a valid preprocessor directive"
Start with the section for all errors related to raw string literals.
135 changes: 75 additions & 60 deletions .openpublishing.redirection.csharp.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,18 +355,6 @@
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0260.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1112.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1691.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0270.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
Expand Down Expand Up @@ -403,23 +391,46 @@
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0854.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1009.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1019.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1029.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1063.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"

},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1067.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-types"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1112.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1501.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md",
"redirect_url": "/dotnet/csharp/misc/cs1503"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1691.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1704.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
Expand Down Expand Up @@ -1622,10 +1633,6 @@
"source_path_from_root": "/docs/csharp/misc/cs0282.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0501.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0400.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
Expand All @@ -1650,6 +1657,10 @@
"source_path_from_root": "/docs/csharp/misc/cs0466.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/params-arrays"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0501.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/partial-declarations"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0514.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/constructor-errors#static-constructors"
Expand Down Expand Up @@ -1830,6 +1841,18 @@
"source_path_from_root": "/docs/csharp/misc/cs0839.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/parameter-argument-mismatch"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1007.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1011.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1012.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1016.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/parameter-argument-mismatch"
Expand All @@ -1854,10 +1877,6 @@
"source_path_from_root": "/docs/csharp/misc/cs1028.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1029.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1030.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
Expand All @@ -1871,35 +1890,11 @@
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1040.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1517.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1560.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1576.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1578.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1633.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1634.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
"source_path_from_root": "/docs/csharp/misc/cs1039.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/string-literal"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1635.md",
"source_path_from_root": "/docs/csharp/misc/cs1040.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
Expand Down Expand Up @@ -1930,10 +1925,6 @@
"source_path_from_root": "/docs/csharp/misc/cs1106.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1007.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1109.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
Expand All @@ -1946,18 +1937,26 @@
"source_path_from_root": "/docs/csharp/misc/cs1113.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md",
"redirect_url": "/dotnet/csharp/misc/cs1503"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1510.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/ref-modifiers-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1517.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1529.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/using-directive-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1534.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1535.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1537.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/using-directive-errors"
Expand All @@ -1966,6 +1965,18 @@
"source_path_from_root": "/docs/csharp/misc/cs1552.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1560.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1576.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1578.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1586.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
Expand Down Expand Up @@ -2023,12 +2034,16 @@
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1534.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
"source_path_from_root": "/docs/csharp/misc/cs1633.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1535.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
"source_path_from_root": "/docs/csharp/misc/cs1634.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1635.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1637.md",
Expand Down
Loading