-
Notifications
You must be signed in to change notification settings - Fork 303
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
Use super parameters in snippets #3899
Comments
@bwilkerson for code generated by the server (for ex. snippets), should super parameters be used whenever supported, or only if the lint is also enabled? |
I think it's reasonable for snippets to make use of any valid language feature that makes the generated code better. I think that it's reasonable to not produce some style of code when there's a lint that prohibits it (that is, to allow lints to reduce the set of valid language features), but I don't think we want to require users to "enable" new language features before we start producing them in generated code. Or, at least, we don't want to require them to enable it again; they already had to opt in once by increasing the minimum SDK version. |
+1 I think if the package has a lower SDK bound of at least 2.17.0-0 (indicating that super params are supported) the macros should use them. |
Working on a change at https://dart-review.googlesource.com/c/sdk/+/240281/. It will only work for server-provided snippets, which are currently something you can turn on if on Flutter |
Fixes Dart-Code/Dart-Code#3899. Change-Id: I9c1e15d2ab127fef786450fde45eba5c4deca240 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240281 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Landed in dart-lang/sdk@fa024be. |
Re: snippets, do https://github.com/Dart-Code/Dart-Code/blob/master/snippets/flutter.json also need to change? |
@eseidelGoogle those snippets shipped in the extension cannot adopt to language versions, so updating them will result in errors for anyone on the current stable SDKs (which don't support super params). Those snippets are being phased out - newer Dart/Flutter SDKs (not the current stable version, but future versions) will get their snippets from the server, which can adopt to language versions (and lints). We'll automatically switch to the server snippets when they're available (any version of Dart >= 2.17.0-258), so if you're using Those local snippets will likely be removed some time in the future when we drop support for old SDK versions (there's no planned timeline, but ultimately we'll require versions of the SDK that support LSP and DAP, and you'll need to use an older VS Code extension version if you really need to stick on a very old Dart/Flutter version), but in the meantime they will be left as-is (to be as compatible as possible). (lmk if anything isn't clear!) |
Makes sense. Thanks!
…On Mon, May 2, 2022 at 10:50 AM Danny Tuppeny ***@***.***> wrote:
@eseidelGoogle <https://github.com/eseidelGoogle> those snippets shipped
in the extension cannot adopt to language versions, so updating them will
result in errors for anyone on the current stable SDKs (which don't support
super params). Those snippets are being phased out - newer Dart/Flutter
SDKs (not the current stable version, but future versions) will get their
snippets from the server, which can adopt to language versions (and lints).
We'll automatically switch to the server snippets when they're available (any
version of Dart >= 2.17.0-258
<https://github.com/Dart-Code/Dart-Code/blob/master/src/shared/capabilities/dart.ts#L36>),
so if you're using master you should already see super params in the
snippets. If you're on stable, it'll happen automatically after the next
stable release.
Those local snippets will likely be removed some time in the future when
we drop support for old SDK versions (there's no planned timeline, but
ultimately we'll require versions of the SDK that support LSP and DAP, and
you'll need to use an older VS Code extension version if you really need to
stick on a very old Dart/Flutter version), but in the meantime they will be
left as-is (to be as compatible as possible).
(lmk if anything isn't clear!)
—
Reply to this email directly, view it on GitHub
<#3899 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2O7C2GKEV7C6FREWO2DJLVIAIVLANCNFSM5SHZM2UQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Is your feature request related to a problem? Please describe.
Feature: dart-lang/language#1855, Flutter repo work: flutter/flutter#100575
Describe the solution you'd like
Tweak the snippets to adopt this feature
The text was updated successfully, but these errors were encountered: