Dart-Code / Dart-Code

Dart and Flutter support for VS Code
https://dartcode.org/
MIT License
1.46k stars 295 forks source link

"Go to Augmented" does not show up for augmentations of augmentations #5064

Closed DanTup closed 1 month ago

DanTup commented 1 month ago

In the library augmentation (right), the second augmentation is missing the CodeLens (yet the first one does have "Go to Augmentation").

image

DanTup commented 1 month ago

Not in the server response.

{
    "id": 40,
    "jsonrpc": "2.0",
    "result": [
        {
            "command": {
                "arguments": [
                    {
                        "range": {
                            "end": { "character": 17, "line": 2 },
                            "start": { "character": 14, "line": 2 }
                        },
                        "uri": "file:///C:/Dev/Test%20Projects/augmentation_testing/lib/foo_augmentation.dart"
                    }
                ],
                "command": "dart.goToLocation",
                "title": "Go to Augmented"
            },
            "range": {
                "end": { "character": 17, "line": 2 },
                "start": { "character": 14, "line": 2 }
            }
        },
        {
            "command": {
                "arguments": [
                    {
                        "range": {
                            "end": { "character": 18, "line": 3 },
                            "start": { "character": 15, "line": 3 }
                        },
                        "uri": "file:///C:/Dev/Test%20Projects/augmentation_testing/lib/foo_augmentation.dart"
                    }
                ],
                "command": "dart.goToLocation",
                "title": "Go to Augmented"
            },
            "range": {
                "end": { "character": 18, "line": 3 },
                "start": { "character": 15, "line": 3 }
            }
        },
        {
            "command": {
                "arguments": [
                    {
                        "range": {
                            "end": { "character": 17, "line": 8 },
                            "start": { "character": 14, "line": 8 }
                        },
                        "uri": "file:///C:/Dev/Test%20Projects/augmentation_testing/lib/foo_augmentation.dart"
                    }
                ],
                "command": "dart.goToLocation",
                "title": "Go to Augmentation"
            },
            "range": {
                "end": { "character": 17, "line": 2 },
                "start": { "character": 14, "line": 2 }
            }
        },
        {
            "command": {
                "arguments": [
                    {
                        "range": {
                            "end": { "character": 18, "line": 9 },
                            "start": { "character": 15, "line": 9 }
                        },
                        "uri": "file:///C:/Dev/Test%20Projects/augmentation_testing/lib/foo_augmentation.dart"
                    }
                ],
                "command": "dart.goToLocation",
                "title": "Go to Augmentation"
            },
            "range": {
                "end": { "character": 18, "line": 3 },
                "start": { "character": 15, "line": 3 }
            }
        }
    ]
}
DanTup commented 1 month ago

This seems to be because we're using a Map to store CodeLens against each declaration, but for the augmentations they're the same. Opened https://github.com/dart-lang/sdk/issues/55408.

DanTup commented 1 month ago

Fixed by https://github.com/dart-lang/sdk/commit/32e593c3e3485820725c8356519cfaa5d102733d