-
Notifications
You must be signed in to change notification settings - Fork 32
contribute a fix_data.yaml file to enable 'dart fix' renames #141
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
- title: "Rename to 'HTMLAnchorElement'" | ||
date: 2024-01-12 | ||
element: | ||
uris: [ 'package:web/web.dart' ] |
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.
@keertip - should this be package:web/web.dart
? web.dart
? I see different things in the flutter package dart fix data.
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.
Either ought to be fine. The shorter form is an "abbreviated URI". See https://github.com/flutter/flutter/wiki/Data-driven-Fixes#uri.
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.
Either should be fine. Though we do have this open issue - dart-lang/sdk#52233.
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.
Hmm - is that issue a blocker? Does it mean we should include both types of urls in the fix data file (web.dart
and package:web/web.dart
)? Is this is going to affect us it would be great to prioritize that fix for the next release.
example/example.dart
Outdated
@@ -5,6 +5,11 @@ | |||
import 'package:web/web.dart'; | |||
|
|||
void main() { | |||
final div = document.querySelector('div') as HTMLDivElement; | |||
// ignore: unused_local_variable | |||
final HtmlDocument foo = document; |
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.
This location does offer a quick fix, to rename to Document
.
example/example.dart
Outdated
// ignore: unused_local_variable | ||
final HtmlDocument foo = document; | ||
|
||
final doc = document as HtmlDocument; |
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.
This location does not offer a quick fix. Should I define the fix data differently? Is the rename fix expected to cover this case?
cc @keertip
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.
I would have expected the rename change to cover this case. It looks like a bug to me.
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.
As Brian said, it should, otherwise it is a bug. Could you open an issue to capture this?
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.
Somewhat related - and I can open a separate issue for this - quick fix will currently un-do the work of the ![]() The 3rd item above is what we want the user to select - to rename the older symbol name to the new ( |
It would be great to be able to bump the 'rename' quick fix to be first in the list in any case - for it to be suggested ahead of the 'create new class' fix. |
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.
Consider defining tests for each of the transformations as per https://github.com/flutter/flutter/wiki/Data-driven-Fixes#testing. I strongly recommend having at least one .dart
file per transform, even though the flutter team has chosen to put the tests for multiple transforms in a single file. I think it makes it much easier to debug problems when the test files are smaller.
example/example.dart
Outdated
// ignore: unused_local_variable | ||
final HtmlDocument foo = document; | ||
|
||
final doc = document as HtmlDocument; |
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.
I would have expected the rename change to cover this case. It looks like a bug to me.
- title: "Rename to 'HTMLAnchorElement'" | ||
date: 2024-01-12 | ||
element: | ||
uris: [ 'package:web/web.dart' ] |
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.
Either ought to be fine. The shorter form is an "abbreviated URI". See https://github.com/flutter/flutter/wiki/Data-driven-Fixes#uri.
Thanks for the feedback and the idea! I added content in a |
Glad we found the bugs. |
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.
Awesome, thanks for working on this! I commented on the other issue on why we might be missing some of the mappings. (I'm approving from my perspective - better to have some of the analyzer folks approve before submitting)
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 for the fix_data.yaml file. Please do test that dart fix works if you change the uri from 'package:'.
I did try updating the fix_data references to use |
Generate extension type bindings Generate extension types instead of classes Refactors some code around overrides so we don't emit @js unless they're needed. Updates code_builder dep to 4.10.0 and dart_style to 2.3.4. Clean up JS supertype generation contribute a fix_data.yaml file to enable 'dart fix' renames (dart-lang#141) contribute a fix_data.yaml file to enable 'dart fix' renames collect MDN API information (dart-lang#130) collect MDN info for use in API documentation Redeprecate deprecated APIs in 0.4.1 (dart-lang#142) Undeprecate some APIs and prepare for publish of 0.4.2 (dart-lang#140) move bindings_generator/ to tool/generator/ (dart-lang#138) rev to 0.4.1 in preparation for publishing (dart-lang#135) Update generate copyright year to 2024 (dart-lang#136) Change-Id: I0f90fc08fd7871f8331f42c158cb7ba34e6bf887
dart:html
topackage:web
dart fix
renames for this package #139@keertip - can you review the fix_data.yaml file? I have some questions about it (in-line).
cc @bwilkerson and @jacob314 as we discussed this yesterday
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.