/// The default version to use for formatting code when there is no better
/// effective language version for the code.
///
/// This is the minimum of the latest version supported by the formatter or
/// the current language version.
final defaultFormatterVersion =
DartFormatter.latestLanguageVersion < ExperimentStatus.currentVersion
? DartFormatter.latestLanguageVersion
: ExperimentStatus.currentVersion;Please check this logic seems sound to you. I don't think we should ever default to formatting with a higher number just because the formatter is from the future, but we also can't just use the current language version because that would require rolling the formatter at the same time as bumping the language version in the SDK?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +1 |
I don't have enough understanding of the problem to know whether this is the right fix. I'm guessing that this will work, but I don't know whether it's the best solution.
I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
I don't have enough understanding of the problem to know whether this is the right fix. I'm guessing that this will work, but I don't know whether it's the best solution.
I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.
I'm guessing that this will work, but I don't know whether it's the best solution.
Yeah, I do have a slight worry that if the formatter has never been ahead of the SDK language before, whether there might be other edge cases we've not considered. If the 3.12 branch isn't far off I would probably suggest waiting until after, but I don't know if that's the case.
> I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.
I just wasn't sure how familiar she is with server so thought I'd defer the decision to you two 😄 (I've moved her over now though)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Danny TuppenyI don't have enough understanding of the problem to know whether this is the right fix. I'm guessing that this will work, but I don't know whether it's the best solution.
I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.
I'm guessing that this will work, but I don't know whether it's the best solution.
Yeah, I do have a slight worry that if the formatter has never been ahead of the SDK language before, whether there might be other edge cases we've not considered. If the 3.12 branch isn't far off I would probably suggest waiting until after, but I don't know if that's the case.
> I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.I just wasn't sure how familiar she is with server so thought I'd defer the decision to you two 😄 (I've moved her over now though)
Looking through the history of dart_style rolls, it seems that the language version supported by the formatter has been lower than the SDK before (https://github.com/dart-lang/sdk/commit/3d63e3a09934a4d8a80c87129cbe5cd340fc86c9 Here where we're rolling formatter supporting 3.11 in 3.12 beta 1), but I'm not sure if we've ever been ahead of the SDK version. This also seems to be the case for 3.9 -> 3.10.
I'm not sure how the server handled this before?
So for the dart_style roll, I can hold off until we reach 3.13 beta 1 (Apr 7) to avoid versioning gymnastics.
But regarding the test here, I think that'll still break if we don't have this change right? Once we get bumped into 3.13 beta 1, the formatter version will be lower than the `ExperimentStatus.currentVersion` until we make a roll.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Danny TuppenyI don't have enough understanding of the problem to know whether this is the right fix. I'm guessing that this will work, but I don't know whether it's the best solution.
I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.
Kallen TuI'm guessing that this will work, but I don't know whether it's the best solution.
Yeah, I do have a slight worry that if the formatter has never been ahead of the SDK language before, whether there might be other edge cases we've not considered. If the 3.12 branch isn't far off I would probably suggest waiting until after, but I don't know if that's the case.
> I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.I just wasn't sure how familiar she is with server so thought I'd defer the decision to you two 😄 (I've moved her over now though)
Looking through the history of dart_style rolls, it seems that the language version supported by the formatter has been lower than the SDK before (https://github.com/dart-lang/sdk/commit/3d63e3a09934a4d8a80c87129cbe5cd340fc86c9 Here where we're rolling formatter supporting 3.11 in 3.12 beta 1), but I'm not sure if we've ever been ahead of the SDK version. This also seems to be the case for 3.9 -> 3.10.
I'm not sure how the server handled this before?So for the dart_style roll, I can hold off until we reach 3.13 beta 1 (Apr 7) to avoid versioning gymnastics.
But regarding the test here, I think that'll still break if we don't have this change right? Once we get bumped into 3.13 beta 1, the formatter version will be lower than the `ExperimentStatus.currentVersion` until we make a roll.
I'm not sure how the server handled this before?
Handled the formatter being ahead? I guess it's possible it hasn't happened before (but it's also possible that it just didn't cause any issues - the failing test here is something I added very recently).
> So for the dart_style roll, I can hold off until we reach 3.13 beta 1 (Apr 7) to avoid versioning gymnastics.
This might mean we can't land some primary constructor changes until then, though probably only those that trigger formatting (and it's possible once https://dart-review.googlesource.com/c/sdk/+/487841 lands, maybe that's not an issue either).
> But regarding the test here, I think that'll still break if we don't have this change right?
Yep, I think the new test might fail whenever the two are out of sync, so I think we should still proceed with this CL even if we don't intended for the formatter to be ahead. It's possible that with this change the formatter being ahead is a non-issue, but I don't know what that value (`DartFormatter.latestLanguageVersion`) is used for inside the formatter - perhaps Bob has the most context to determine that.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Danny TuppenyI don't have enough understanding of the problem to know whether this is the right fix. I'm guessing that this will work, but I don't know whether it's the best solution.
I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.
Kallen TuI'm guessing that this will work, but I don't know whether it's the best solution.
Yeah, I do have a slight worry that if the formatter has never been ahead of the SDK language before, whether there might be other edge cases we've not considered. If the 3.12 branch isn't far off I would probably suggest waiting until after, but I don't know if that's the case.
> I'm also not sure who else ought to review this. I would have guessed Kallen, but you added her as a CC rather than as a reviewer.I just wasn't sure how familiar she is with server so thought I'd defer the decision to you two 😄 (I've moved her over now though)
Danny TuppenyLooking through the history of dart_style rolls, it seems that the language version supported by the formatter has been lower than the SDK before (https://github.com/dart-lang/sdk/commit/3d63e3a09934a4d8a80c87129cbe5cd340fc86c9 Here where we're rolling formatter supporting 3.11 in 3.12 beta 1), but I'm not sure if we've ever been ahead of the SDK version. This also seems to be the case for 3.9 -> 3.10.
I'm not sure how the server handled this before?So for the dart_style roll, I can hold off until we reach 3.13 beta 1 (Apr 7) to avoid versioning gymnastics.
But regarding the test here, I think that'll still break if we don't have this change right? Once we get bumped into 3.13 beta 1, the formatter version will be lower than the `ExperimentStatus.currentVersion` until we make a roll.
I'm not sure how the server handled this before?
Handled the formatter being ahead? I guess it's possible it hasn't happened before (but it's also possible that it just didn't cause any issues - the failing test here is something I added very recently).
> So for the dart_style roll, I can hold off until we reach 3.13 beta 1 (Apr 7) to avoid versioning gymnastics.This might mean we can't land some primary constructor changes until then, though probably only those that trigger formatting (and it's possible once https://dart-review.googlesource.com/c/sdk/+/487841 lands, maybe that's not an issue either).
> But regarding the test here, I think that'll still break if we don't have this change right?Yep, I think the new test might fail whenever the two are out of sync, so I think we should still proceed with this CL even if we don't intended for the formatter to be ahead. It's possible that with this change the formatter being ahead is a non-issue, but I don't know what that value (`DartFormatter.latestLanguageVersion`) is used for inside the formatter - perhaps Bob has the most context to determine that.
Handled the formatter being ahead?
Ah, handled the formatter being behind I mean. There was some period of time where we were on formatter Dart version 3.11 while the SDK was in 3.12.
So for the dart_style roll, I can hold off until we reach 3.13 beta 1 (Apr 7) to avoid versioning gymnastics.
This might mean we can't land some primary constructor changes until then
Yeah, I immediately realized we probably can't do that. Konstantin has work that requires an analyzer update in https://github.com/dart-lang/dart_style/pull/1815#event-23559758606. So we'll have to push things in.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The only language feature I see that was released in 3.12 was private_named_parameters, and that didn't require any changes to either the parser or the formatter. Which would explain why it was ok in that case.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[analysis_server] Use the minimum of SDK language version and formatter version for formatting
This allows the formatter to be both ahead or behind the SDK version and still format correctly. We should not use a newer language version than the SDK is using, and we cannot use a newer version than the formatter supports.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Handled the formatter being ahead? I guess it's possible it hasn't happened before
I don't think it has happened before. The formatter has only cared about language versioning since around Dart 3.7. Since then, I've usually bumped DartFormatter.latestLanguageVersion to the upcoming SDK version and rolled that into the SDK shortly before a release. I don't usually get ahead of the SDK but primary constructors + me going on leave (I'm back!) made things a little wonky.
In general, I wish the formatter didn't have that hardcoded constant in there at all. It's a chore to remember to bump that for every SDK release. Unfortunately, it's in the public API as a constant and used by some packages, so it wouldn't be possible to change the way this works without a breaking change. Longer-term I would like to come up with a cleaner way for the formatter to handle defaulting to a language version, but I'm not sure what that looks like yet.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |