Skip to content

"See code in" example links incorrectly group multiple examples, don't linkify entire path #4181

@gspencergoog

Description

@gspencergoog

When navigating to an example in the Flutter repo source code in the form of:

/// {@tool dartpad}
/// This example shows various [ClipRRect]s applied to containers.
///
/// ** See code in examples/api/lib/widgets/basic/clip_rrect.0.dart **
/// {@end-tool}
/// ...
/// {@tool dartpad}
/// This example shows a [ClipRRect] that adds round corners to an image.
///
/// ** See code in examples/api/lib/widgets/basic/clip_rrect.1.dart **
/// {@end-tool}

If there are multiple examples in the comment then it says that there are two possible "definitions" for the destination, when the analyzer should be supplying the full path to the destination under the pointer, and so VSCode should be linkifying the entire path, not just the path element.

Screenshot from 2022-09-26 16-26-33

If there is only one example in the dartdoc block, then it more correctly links to just the link under the pointer:

Screenshot from 2022-09-26 16-27-08

However, it seems to me that VSCode should be rendering the links in another color (the "link" color that is used by symbol refs in brackets) so that users even know that they can click on them. It's not very discoverable to have to ctrl-click on the path in a comment, since it's not expected that it is a symbol.

It also seems like in that screenshot that the tooltip/hover text is showing an empty tip, which also shouldn't happen.

To Reproduce
Steps to reproduce the behavior:

  1. Open flutter/packages/flutter/lib/src/widgets/basic.dart in the Flutter repo.
  2. Point at the path in the "See code in" marker in the dartdoc block for ClipRRect.
  3. If you press Ctrl/Cmd while pointing at parts of the path, it will only highlight that part of the path, and will think there are two destinations.

Expected behavior

  1. Draw the link in the "link" color, even when not pointing at it.
  2. When pointing at it with Ctrl/Cmd down, linkify the entire path, not just the component under the pointer.
  3. When clicking on the path, it should just navigate without having to disambiguate, even if there are multiple examples.
  4. When pointing at a link, don't show an empty tooltip.

Please complete the following information:

  • Operating System and version: Debian GNU/Linux rodete 5.18.16-1rodete1-amd64
  • VS Code version: 1.71.2
  • Dart extension version: v3.48.4
  • Flutter extension version: v3.48.0
  • Dart/Flutter SDK version: Dart version 2.19.0 (build 2.19.0-229.0.dev)/Flutter version 3.4.0-29.0.pre.111

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions