Skip to content

Fix missing backtick and incorrect variable in DiagnosticLinkInlineParser#2261

Merged
reakaleek merged 5 commits intomainfrom
copilot/fix-closing-backtick-error
Mar 24, 2026
Merged

Fix missing backtick and incorrect variable in DiagnosticLinkInlineParser#2261
reakaleek merged 5 commits intomainfrom
copilot/fix-closing-backtick-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 24, 2025

  • Fix missing closing backtick in error message on line 275
  • Fix incorrect variable usage (url -> newUrl) in LastIndexOf on line 343
  • Run unit tests to ensure changes don't break existing functionality
  • Verify build succeeds after changes
  • Verify code formatting
  • Fix indentation to use tabs instead of spaces (lines 280-282)
Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"Missing closing backtick in the error message. The string should end with `{pathOnDisk}`.","fixFiles":[{"filePath":"src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs","diff":"diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n--- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n+++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n@@ -272,7 +272,7 @@\n \t\t\t\tprocessor.EmitWarning(link, $\"Local file `{url}` has a redirect, please update this reference to: {name}\");\n \t\t\t}\n \t\t\telse\n-\t\t\t\tprocessor.EmitError(link, $\"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}\");\n+\t\t\t\tprocessor.EmitError(link, $\"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}`\");\n \n \t\t}\n \t}\n"}]},{"message":"Using `url` instead of `newUrl` for LastIndexOf is incorrect. This should be `newUrl.LastIndexOf(\".md\", StringComparison.Ordinal)` to maintain consistency with the variable being modified.","fixFiles":[{"filePath":"src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs","diff":"diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n--- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n+++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n@@ -340,7 +340,7 @@\n \t\t{\n \t\t\tnewUrl = newUrl.EndsWith($\"{Path.DirectorySeparatorChar}index.md\")\n \t\t\t\t? newUrl.Remove(newUrl.LastIndexOf(\"index.md\", StringComparison.Ordinal), \"index.md\".Length)\n-\t\t\t\t: newUrl.Remove(url.LastIndexOf(\".md\", StringComparison.Ordinal), \".md\".Length);\n+\t\t\t\t: newUrl.Remove(newUrl.LastIndexOf(\".md\", StringComparison.Ordinal), \".md\".Length);\n \t\t}\n \n \t\t// TODO this is hardcoded should be part of extension system\n"}]}]

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: reakaleek <16325797+reakaleek@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing closing backtick in error message Fix missing backtick and incorrect variable in DiagnosticLinkInlineParser Nov 24, 2025
Copilot AI requested a review from reakaleek November 24, 2025 12:27
@reakaleek reakaleek added the fix label Jan 30, 2026
@reakaleek reakaleek marked this pull request as ready for review January 30, 2026 08:04
@reakaleek reakaleek requested a review from a team as a code owner January 30, 2026 08:04
@reakaleek reakaleek requested a review from Mpdreamz January 30, 2026 08:04
Comment on lines +280 to +282
{
processor.EmitError(link, $"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}`");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot fix the formatting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 763675b - replaced spaces with tabs for consistent indentation.

Co-authored-by: reakaleek <16325797+reakaleek@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 504f7532-e4f7-4d8f-9d9d-0ecace9d2536

📥 Commits

Reviewing files that changed from the base of the PR and between ca05d9a and 766b351.

📒 Files selected for processing (1)
  • src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs

📝 Walkthrough

Walkthrough

Two bug fixes in the diagnostic link parser: First, corrected a string interpolation error message that was missing a closing brace in the format string. Second, fixed the .md extension stripping logic in UpdateLinkUrl to calculate the removal index from newUrl instead of the original url, ensuring the suffix is removed at the correct position after earlier URL transformations.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main fixes in the changeset: a missing closing backtick in an error message and an incorrect variable reference.
Description check ✅ Passed The description is directly related to the changeset, detailing the specific fixes applied with line numbers and the verification steps performed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch copilot/fix-closing-backtick-error

Comment @coderabbitai help to get the list of available commands and usage tips.

@reakaleek reakaleek merged commit 0c0a698 into main Mar 24, 2026
29 checks passed
@reakaleek reakaleek deleted the copilot/fix-closing-backtick-error branch March 24, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants