Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc comments could feel more "first class" if auto-complete/checking worked in IDEs #54440

Open
matanlurey opened this issue Dec 21, 2023 · 4 comments
Labels
analyzer-completion Issues with the analysis server's code completion feature area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@matanlurey
Copy link
Contributor

See the following example:

final class Constitution extends Ability {
  /// An alias for [AbilityKind.constitution].
  static const kind = AbilityKind.constitution;

  /* rest omitted. */
}
  1. If I select .constitution and start typing over it, i.e. .^d, I'll get dexterity suggested to me.
  2. If I mistype .dexxterity it will be marked as a diagnostic.

In the [ ... ]-comments, 1 does not work and 2 does (indirectly) through the comment_references lint (as an side, I'd love to see https://dart.dev/tools/linter-rules/comment_references become part of the analyzer by default with the "right" rules).

/cc @srawlins

@matanlurey
Copy link
Contributor Author

Oh, and rename doesn't work, that would be nice too :)

@parlough
Copy link
Member

I'm not sure what iteration/version of the design is the most current, but a lot of this is dependent on or at least discussed in #50702.

@parlough parlough added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Dec 22, 2023
@bwilkerson bwilkerson added the P2 A bug or feature request we're likely to work on label Jan 2, 2024
@gnprice
Copy link
Contributor

gnprice commented Jan 5, 2024

For me this often does work already, in Android Studio with the Dart plugin (and the Flutter plugin, but that one's probably not involved). In particular, (1) works great for me in the case of enum values, which are what appear to be in your example. Are you using Android Studio or a different IDE?

Similarly "rename" works great — if I rename some variable, function, etc., then references to it in dartdoc get updated too. (Presumably it only works for references that were successfully resolved, which pending #50702 isn't as comprehensive as one would like it to be.)

If it's working for me in Android Studio / IntelliJ but not you when using a different IDE, then it's likely this is an issue for the IDE plugin.

@bwilkerson
Copy link
Member

  1. If I select .constitution and start typing over it, i.e. .^d, I'll get dexterity suggested to me.

I extended your example slightly in order to have error-free code to start from:

final class Constitution extends Ability {
  /// An alias for [AbilityKind.constitution].
  static const kind = AbilityKind.constitution;

  /* rest omitted. */
}

class Ability {}
enum AbilityKind {constitution, dexterity}

I might have guessed wrong about how Ability and AbilityKind are declared, and that might account for the difference, but using an SDK built from HEAD code completion (after AbilityKind.) worked in both locations.

... (as an side, I'd love to see https://dart.dev/tools/linter-rules/comment_references become part of the analyzer by default with the "right" rules).

As Parker noted, this is dependent on work that we're currently doing to remove some of the special case handling that dartdoc does (inferring resolutions for un-imported references in doc comments) so that all of our tooling can have the same sematics. Until then the analyzer won't be able to know, without dartdoc's whole-world assumption, whether the reference is valid or not. As part of this work we'll convert the lint to a warning.

@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Apr 5, 2024
@srawlins srawlins changed the title Dartdoc could feel more "first class" if auto-complete/checking worked in IDEs Doc comments could feel more "first class" if auto-complete/checking worked in IDEs Dec 13, 2024
@srawlins srawlins added the analyzer-completion Issues with the analysis server's code completion feature label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-completion Issues with the analysis server's code completion feature area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants