Skip to content

Comments

[Repo Assist] fix: handle href and langword in seealso XML doc rendering#1463

Merged
Krzysztof-Cieslak merged 2 commits intomainfrom
repo-assist/fix-seealso-href-rendering-0b80143e0b376c39
Feb 24, 2026
Merged

[Repo Assist] fix: handle href and langword in seealso XML doc rendering#1463
Krzysztof-Cieslak merged 2 commits intomainfrom
repo-assist/fix-seealso-href-rendering-0b80143e0b376c39

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Improves rendering of (seealso) XML documentation tags in hover tooltips and documentation panels. The current code assumes every (seealso) node uses a cref attribute and accesses Attributes.[0] directly, which can produce wrong output or silently skip entries when href is used.

Root Cause

In TipFormatter.fs, the seeAlso binding uses a Seq.map that directly accesses node.Attributes.[0].InnerText without checking the attribute name:

// Before
|> Seq.map (fun node -> "* `" + Format.extractMemberText node.Attributes.[0].InnerText + "`")

This works fine for (seealso cref="T:Foo.Bar"/), but:

  • (seealso href="(example.com/redacted)"/) renders the URL through extractMemberText (which strips type-prefixes, e.g. T:) — wrong output
  • (seealso href="(example.com/redacted)")Click here(/seealso) — same problem, inner text ignored
  • (seealso langword="null"/) — rendered as a cref member name — wrong output

By contrast, the inline (see) formatter (also in TipFormatter.fs) already handles href, cref, and langword correctly via named attribute lookups. The seealso section had fallen behind.

Fix

Replace the Seq.map with a Seq.choose that inspects attribute names explicitly, mirroring the see formatter's behaviour:

  • cref* `MemberText` (unchanged from current behaviour)
  • href (with inner text) → * [inner text](url)
  • href (void element) → * [url](url)
  • langword* `keyword`
  • No recognised attribute → skipped (avoids noise from malformed tags)

Test Status

  • Build: ✅ dotnet build src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj -f net8.0 succeeded with 0 warnings, 0 errors.
  • Formatting: ✅ dotnet fantomas reports TipFormatter.fs was unchanged (code already matches fantomas style).
  • Tests: Infrastructure constraint in this environment prevented running the full test suite. The change is confined to the seeAlso sequence expression inside XmlDocMember; it only adds proper href/langword handling and silently skips unrecognised nodes rather than crashing.

Related

Partially addresses #1027 (see and seealso should render as links/commands) — this PR specifically fixes the seealso href and langword cases. Full command-URI support for cref entries is a larger task left for a follow-up.

Generated by Repo Assist

Generated by Repo Assist

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@828ac109efb43990f59475cbfce90ede5546586c. View source at https://github.com/githubnext/agentics/tree/828ac109efb43990f59475cbfce90ede5546586c/workflows/repo-assist.md.

The seealso section in tooltip/hover documentation incorrectly assumed
all <seealso> tags use cref attributes, directly accessing Attributes.[0]
without checking the attribute name. This could produce wrong output for
<seealso href="url"/> tags and crashes if no attributes are present.

Fix mirrors the behaviour of the <see> formatter:
- cref: render as backtick-wrapped member name (unchanged)
- href: render as a markdown link [text](url) or [url](url)
- langword: render as inline code (consistent with <see langword="..."/>)
- no recognised attribute: skip silently via Seq.choose

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Pull request created: #1463

@Krzysztof-Cieslak
Copy link
Member

/repo-assist add tests to this PR

…ord)

Tests cover all four attribute variants handled by the fix in TipFormatter.fs:
- cref renders as backtick-quoted member name
- href (void) renders as auto-link
- href (with inner text) renders as labelled Markdown link
- langword renders as backtick-quoted keyword
- unrecognised attribute is silently skipped (no garbled output)
- multiple seealso entries all appear together

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 6ef4281

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

I've added unit tests to this PR covering the (seealso) rendering fix. The tests are in a new file test/FsAutoComplete.Tests.Lsp/TipFormatterTests.fs and exercise all four attribute variants:

Test case Expected output
(seealso cref="T:Foo.Bar"/) * `Foo.Bar`
(seealso href="(example.com/redacted)"/) * [(example.com/redacted)]((example.com/redacted))
(seealso href="(example.com/redacted)")Click here(/seealso) * [Click here]((example.com/redacted))
(seealso langword="null"/) * `null`
unrecognised attribute silently skipped (no "See also" section)
multiple entries together all appear in the See also section

All 6 tests pass against the fixed code (and would fail against the old node.Attributes.[0] approach).

Test run:

6 tests run – 6 passed, 0 ignored, 0 failed, 0 errored. ✅

Generated by Repo Assist for issue #1463

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@b0e9cfd3a20372ce7fe0462bb7bbca2272df4a88. View source at https://github.com/githubnext/agentics/tree/b0e9cfd3a20372ce7fe0462bb7bbca2272df4a88/workflows/repo-assist.md.

@Krzysztof-Cieslak Krzysztof-Cieslak marked this pull request as ready for review February 24, 2026 12:54
@Krzysztof-Cieslak Krzysztof-Cieslak merged commit b12c6da into main Feb 24, 2026
26 checks passed
github-actions bot added a commit that referenced this pull request Feb 24, 2026
Include all PRs merged since v0.83.0:
- #1441: Fix SourceLink go-to-def failure on .NET 10 on Linux
- #1452: Add FSharp.notifications.backgroundServiceProgress config option
- #1449: Fix semantic token multiline range uint32 underflow
- #1453: Fix spurious get/set rename in TextDocumentRename
- #1454: Fix missing { interpolated string completion trigger
- #1455: Fix non-ASCII path encoding in file URIs
- #1456: Disable inline values by default to restore pipeline hints
- #1457: Fix missing parens in function-type segments in AddExplicitTypeAnnotation
- #1458: Fix signature help parameter types showing fully-qualified names
- #1463: Fix seealso href/langword XML doc rendering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant