[analysis_server] Fix hover on enum constant declaration
Fixes https://github.com/dart-lang/sdk/issues/63223 Change-Id: I42c75520ce11932bd1c894783cbfc27ac3c8ebd2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504260 Reviewed-by: Keerti Parthasarathy <keertip@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Keerti Parthasarathy <keertip@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
57eb6d720c
commit
9a48747a61
@@ -47,6 +47,7 @@ class DartUnitHoverComputer {
|
||||
|
||||
if (node is CompilationUnitMember ||
|
||||
node is CatchClauseParameter ||
|
||||
node is EnumConstantDeclaration ||
|
||||
node is Expression ||
|
||||
node is FormalParameter ||
|
||||
node is MethodDeclaration ||
|
||||
@@ -232,6 +233,7 @@ class DartUnitHoverComputer {
|
||||
ConstructorDeclaration() =>
|
||||
node.name ?? node.typeName ?? node.newKeyword ?? node.factoryKeyword,
|
||||
DeclaredIdentifier() => node.name,
|
||||
EnumConstantDeclaration() => node.name,
|
||||
EnumDeclaration() => node.namePart.typeName,
|
||||
Expression() => node,
|
||||
ExtensionDeclaration() => node.name,
|
||||
|
||||
@@ -450,6 +450,26 @@ Declared in `MyEnum` in *package:test/main.dart*.''';
|
||||
await assertStringContents(content, equals(expected));
|
||||
}
|
||||
|
||||
Future<void> test_enum_member_declaration() async {
|
||||
var content = '''
|
||||
enum E {
|
||||
/// Docs
|
||||
[!on^e!]
|
||||
}
|
||||
''';
|
||||
var expected = '''
|
||||
```dart
|
||||
E one
|
||||
```
|
||||
Type: `E`
|
||||
|
||||
Declared in `E` in *package:test/main.dart*.
|
||||
|
||||
---
|
||||
Docs''';
|
||||
await assertStringContents(content, equals(expected));
|
||||
}
|
||||
|
||||
Future<void> test_enum_values() async {
|
||||
var content = '''
|
||||
enum MyEnum { one }
|
||||
|
||||
Reference in New Issue
Block a user