Use newer function type syntax for parameters. - #4290
Open
munificent wants to merge 1 commit into
Open
munificent wants to merge 1 commit into
munificent wants to merge 1 commit into
Conversation
When Dartdoc generates documentation for a function with a parameter whose type is a function type (i.e. a callback), the generated docs use the old pre-Dart-2.0 function-typed parameter syntax. Dartdoc does this even if the function itself uses the newer syntax. For over five years, we have had a recommended lint telling users not to use the old function-typed parameter syntax. Newer Dart users may not be familiar with it at all. Our generated docs should probably use the same syntax that we recommend that users write. :) Also, I am working on a proposal to drop support for the old function-typed parameter syntax completely. If that happens, then we should definitely stop using the old non-existent syntax. (See dart-lang/language#4782). This obviously affects the output of Dartdoc pretty significantly, so I'm not sure what landing this entails, but I figured I'd put together a PR and send it out to start that discussion. If now is not the right time to make a change like this, that's OK too, but I do think we should make this change at some point. Fix #3671.
There was a problem hiding this comment.
Code Review
This pull request updates the parameter renderer to use the newer function type syntax for parameters whose type is a function, replacing the older "function-typed parameter" syntax. The rendering logic in lib/src/render/parameter_renderer.dart has been simplified, and corresponding tests in test/end2end/model_test.dart and test/parameters_test.dart have been updated and expanded to verify the new output format. There are no review comments to evaluate, so I have no feedback to provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Dartdoc generates documentation for a function with a parameter whose type is a function type (i.e. a callback), the generated docs use the old pre-Dart-2.0 function-typed parameter syntax. Dartdoc does this even if the function itself uses the newer syntax.
For over five years, we have had a recommended lint telling users not to use the old function-typed parameter syntax. Newer Dart users may not be familiar with it at all. Our generated docs should probably use the same syntax that we recommend that users write. :)
Also, I am working on a proposal to drop support for the old function-typed parameter syntax completely. If that happens, then we should definitely stop using the old non-existent syntax. (See dart-lang/language#4782).
This obviously affects the output of Dartdoc pretty significantly, so I'm not sure what landing this entails, but I figured I'd put together a PR and send it out to start that discussion. If now is not the right time to make a change like this, that's OK too, but I do think we should make this change at some point.
Fix #3671.