-
Notifications
You must be signed in to change notification settings - Fork 118
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
Centralize unparsing of comment references #2630
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I know just a draft, but I couldn't help but look!
@@ -0,0 +1,29 @@ | |||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2021?
@@ -126,10 +126,6 @@ final RegExp nonHTML = | |||
/// parentheses. | |||
final _trailingIgnorePattern = RegExp(r'(<.*>|\(.*\)|\?|!)$'); | |||
|
|||
@Deprecated('Public variable intended to be private; will be removed as early ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woohoo!
lib/src/markdown_processor.dart
Outdated
@@ -369,26 +357,25 @@ MatchingLinkResult _getMatchingLinkElementLegacy(String codeRef, | |||
} | |||
|
|||
/// Given a set of commentRefs, return the one whose name matches the codeRef. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the doc comment doesn't apply any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote a more complete doc.
/// [CommentReference]. | ||
static String _referenceText( | ||
CommentReference ref, ResourceProvider resourceProvider) { | ||
var contents = getFileContentsFor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this super expensive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fortunately not. It is cached so we only pay a read penalty once per file.
@@ -0,0 +1,29 @@ | |||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed
lib/src/markdown_processor.dart
Outdated
@@ -369,26 +357,25 @@ MatchingLinkResult _getMatchingLinkElementLegacy(String codeRef, | |||
} | |||
|
|||
/// Given a set of commentRefs, return the one whose name matches the codeRef. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote a more complete doc.
I have redone some benchmarks before marking this as ready for review, to make sure the changes to comment reference handling didn't harm performance. Fortunately, the delta is negligible. |
Before implementing new parsing of comment references, we should clean up how dartdoc gets comment references in the first place. Unparsing them is now centralized which should make it more clear how the analyzer AST could help dartdoc by providing the raw string.
Breaking change: commentRefs, a member of ModelElements, is a map now instead of a list.