Skip to content

parse scaladoc wiki links with a shared backtick/nesting-aware parser - #8676

Merged
tgodzik merged 1 commit into
scalameta:mainfrom
jozanek:fix/wiki-link-parsing
Jul 21, 2026
Merged

parse scaladoc wiki links with a shared backtick/nesting-aware parser#8676
tgodzik merged 1 commit into
scalameta:mainfrom
jozanek:fix/wiki-link-parsing

Conversation

@jozanek

@jozanek jozanek commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

First part of #8658, paritally fixing #3383

Summary by CodeRabbit

  • Bug Fixes

    • Improved Scaladoc and Javadoc link parsing, including links with custom titles, nested brackets, signatures, and backticked names.
    • Fixed navigation so links resolve to their actual target symbols rather than displayed titles.
    • Correctly renders quoted @see text as plain text instead of a link.
  • Tests

    • Added coverage for complex link formats, offset detection, and definition navigation.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

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: 4a9f7d0c-5c7e-4f68-9cfd-0aa6f6d5b718

📥 Commits

Reviewing files that changed from the base of the PR and between 51f35ed and b192124.

📒 Files selected for processing (7)
  • metals/src/main/scala/scala/meta/internal/metals/ScaladocDefinitionProvider.scala
  • mtags/src/main/scala/scala/meta/internal/metals/docstrings/ScaladocParser.scala
  • mtags/src/main/scala/scala/meta/internal/metals/docstrings/WikiLink.scala
  • project/TestGroups.scala
  • tests/unit/src/test/scala/tests/DefinitionLspSuite.scala
  • tests/unit/src/test/scala/tests/JavadocSuite.scala
  • tests/unit/src/test/scala/tests/WikiLinkSuite.scala

📝 Walkthrough

Walkthrough

Adds shared Scaladoc wiki-link parsing for target/title extraction and offset lookup, applies it to rendering and definition navigation, handles quoted @see text as plain text, and adds focused parser, rendering, navigation, and test-group coverage.

Changes

Scaladoc WikiLink handling

Layer / File(s) Summary
Shared WikiLink parser
mtags/src/main/scala/scala/meta/internal/metals/docstrings/WikiLink.scala, mtags/src/main/scala/scala/meta/internal/metals/docstrings/ScaladocParser.scala
Adds stateful target/title parsing and offset-based link resolution, replacing local regex parsing and treating quoted @see text as plain text.
Definition link resolution
metals/src/main/scala/scala/meta/internal/metals/ScaladocDefinitionProvider.scala
Uses WikiLink.atOffset to resolve Scaladoc definition targets while preserving the Scala version flag.
Parser and navigation validation
tests/unit/src/test/scala/tests/WikiLinkSuite.scala, tests/unit/src/test/scala/tests/JavadocSuite.scala, tests/unit/src/test/scala/tests/DefinitionLspSuite.scala, project/TestGroups.scala
Adds coverage for nested links, titles, backticks, signatures, boundaries, quoted @see text, definition lookup, and test-suite registration.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ScaladocDefinitionProvider
  participant WikiLink
  participant ScalaDocLink
  ScaladocDefinitionProvider->>WikiLink: atOffset(text, offset)
  WikiLink-->>ScaladocDefinitionProvider: target
  ScaladocDefinitionProvider->>ScalaDocLink: create definition link
Loading

Suggested reviewers: tgodzik, zielinsky

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: introducing a shared, backtick- and nesting-aware Scaladoc wiki link parser.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@tgodzik tgodzik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tgodzik
tgodzik merged commit cb485be into scalameta:main Jul 21, 2026
31 of 32 checks passed
tgodzik pushed a commit to tgodzik/metals that referenced this pull request Jul 30, 2026
…scalameta#8676)

First part of scalameta#8658, paritally fixing scalameta#3383

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Bug Fixes**
* Improved Scaladoc and Javadoc link parsing, including links with
custom titles, nested brackets, signatures, and backticked names.
* Fixed navigation so links resolve to their actual target symbols
rather than displayed titles.
* Correctly renders quoted `@see` text as plain text instead of a link.

* **Tests**
* Added coverage for complex link formats, offset detection, and
definition navigation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit cb485be)
tgodzik pushed a commit to tgodzik/metals that referenced this pull request Jul 31, 2026
…scalameta#8676)

First part of scalameta#8658, paritally fixing scalameta#3383

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Bug Fixes**
* Improved Scaladoc and Javadoc link parsing, including links with
custom titles, nested brackets, signatures, and backticked names.
* Fixed navigation so links resolve to their actual target symbols
rather than displayed titles.
* Correctly renders quoted `@see` text as plain text instead of a link.

* **Tests**
* Added coverage for complex link formats, offset detection, and
definition navigation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit cb485be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants