-
Notifications
You must be signed in to change notification settings - Fork 124
Extend dartdoc options to begin to handle experiment flags #1884
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
Conversation
Clarifying question: the long term plan with I'm wondering if it would be better for us to define an analyzer API that would let dartdoc ask about what experiments are available so that this information doesn't need to be duplicated in dartdoc source code. Or perhaps we should define an API to allow analyzer clients to access some of the experimental options parsing code in |
@stereotype441 All good questions. First, the easier one: I was planning longer term to generate key parts of the code from a yaml file (DartdocExperimentOptionContext and createExperimentOptions), and have that generated against different yamls in the SDK vs in dartdoc's standalone mode. The harder question you're getting at is the problem of synchronizing dartdoc and analyzer's configuration. Dartdoc has the possibility to have experiments turned off and on based on its dartdoc_options.yaml and that doesn't necessarily sync with the analyzer's configuration. I don't know what kind of API would be useful to synchronize options, but coming up with something here would be a good idea. In the past we just force-switched on analyzer flags we might at some point depend on with a dartdoc feature... |
Oh, as far as sharing the API for option validation, that seems like a more obviously good idea. I did wind up reimplementing what you did slightly differently with different behavior. For example, I took a last conflicting flag wins approach vs returning an error and I'm sure there's more subtlety in there that is really unnecessary. |
@jcollins-g The analyzer already has the problem of synchronizing options between the command-line and Another possibility would be to decide that |
I can see two options for moving forward with this:
WDYT? |
Yes. The PR handles this already with a strict override of what's in the file because that's what's simple and already supported through DartdocOptionArgFile, but it would be quite possible to change.
I think subordinating Dartdoc's options to analyzer's was what I was trying to avoid, but perhaps that's not reasonable. It would be simpler to implement if we did it this way. |
|
Reopening with fixes based on our discussion. We now use |
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.
lgtm, thank you!
The beginnings of experiment flag implementation for https://github.com/dart-lang/sdk/blob/master/docs/process/experimental-flags.md.
Initial non-generated options list borrowed from the analyzer for consistency (https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/src/dart/analysis/experiments.dart).