Skip to content

Analysis server does not provide getter dartdoc when hovering over setter. #38963

Closed
@lrhn

Description

@lrhn

The recommended way to document a getter/setter-pair property is to put DartDoc on the getter only. The DartDoc tool then documents similarly to a field.

The analysis server does not provide the getter DartDoc when hovering over a setter. This can be seen in, e.g., VSCode.
Take code like:

main() {
 var c = C();
 c.foo = null;  // Shows setter-docs when hovering foo.
 c.bar = null;  // No docs when hovering bar.
}

class C {
  /// Getter docs.
  int get foo => 42;
  /// Setter docs.
  void set foo(int x) {}

  /// Getter docs;
  int get bar => 42;
  void set bar(int x) {}
}

It should definitely show the getter docs for bar.
Whether to show the getter or setter docs for foo is a design decision. The DartDoc tool ignores the setter docs.

See #38892 (and perhaps #2798)

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-serverIssues related to some aspect of the analysis serverlegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions