Skip to content

Like named constructor, add constructor modifier for unnamed constructor #4495

Closed

Description

@shujaatak

[Screenshots Attached Below]
I want to apply distinct color to all types of constructors i.e. named or unnamed so that I can quickly spot them wherever they are declared or used. Currently as named constructor has constructor modifier so I have used the following coloring customization:

"method.constructor:dart": { 
    "bold": true,
    "foreground": "#2e32ff",
  },  

Similar to named constructor, if there was constructor modifier for unnamed constructor then I could have used the following:

"class.constructor:dart": {
    "bold": true,
    "foreground": "#2e32ff",
  },  

First look at the Named Constructor that how nicely it has constructor modifier:

image

Now look at the Unnamed Constructor that it doesn't have constructor modifier:

image

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Apr 16, 2023
  2. added
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    in editorRelates to code editing or language features
    and removed
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Apr 17, 2023
  3. added this to the v3.64.0 milestone on Apr 17, 2023
  4. DanTup commented on Apr 17, 2023

    @DanTup
    Member

    This seems like a bug. In constructor invocations the class names already have this modifier, so the current behaviour is not consistent:

    class A {
      A();
      A.named();
    }
    
    final a1 = A(); // A has constructor modifier
    final a2 = A.named(); // both A and named have constructor modifier

    For consistency, A in both constructor declarations should have the modifier.

    I think we might also be missing declaration modifiers on constructors, I'll verify that and file an issue if so.

  5. shujaatak commented on Apr 17, 2023

    @shujaatak
    Author

    @DanTup You never disappoint 🥇
    Thank you for adding this to v3.64.0 milestone!

  6. DanTup commented on Apr 17, 2023

    @DanTup
    Member

    @shujaatak just to set expectations, this change will ship in the Dart SDK because that's where the semantic tokens are produced. For small changes like this one, I tend to include them in the release notes for the month in which they're done under a note of ("these changes require an SDK update") so that users of the beta/master branches are aware of them (and can test them).

    This means it might be longer before the fix will be available in stable SDKs.

  7. shujaatak commented on Apr 17, 2023

    @shujaatak
    Author

    The wait will be worth it!
    Thank you @DanTup

  8. modified the milestones: v3.64.0, v3.66.0 on Apr 24, 2023
  9. DanTup commented on Apr 24, 2023

    @DanTup
    Member

    Fixed by dart-lang/sdk@3069c4f. This change ships in a future SDK update (and not a Dart-Code update).

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 bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions