Skip to content

Use super parameters in snippets #3899

Closed

Description

@guidezpl

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

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Apr 1, 2022
  2. DanTup commented on Apr 1, 2022

    @DanTup
    Member

    @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?

  3. added this to the v3.39.0 milestone on Apr 1, 2022
  4. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Apr 1, 2022
  5. bwilkerson commented on Apr 1, 2022

    @bwilkerson

    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.

  6. goderbauer commented on Apr 1, 2022

    @goderbauer

    +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.

  7. DanTup commented on Apr 5, 2022

    @DanTup
    Member

    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 master using the dart.enableServerSnippets setting but will automatically be enabled when your SDK supports them in an upcoming release of the VS Code extension.

  8. DanTup commented on Apr 6, 2022

    @DanTup
    Member
  9. eseidelGoogle commented on May 2, 2022

    @eseidelGoogle
  10. DanTup commented on May 2, 2022

    @DanTup
    Member

    @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 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!)

  11. eseidelGoogle commented on May 2, 2022

    @eseidelGoogle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions