Skip to content

Allow customisation of closing label prefix and font/size #3628

Closed

Description

Please allow to change the character and / or other styles of the closing labels I see in VS Code.
Currently they look like comments. This triggers me.

For example change the // slashes to # hashtag or / single slash or - minus, etc.. (just an user input)
Or nothing. I don't think the syntax matters. No need for slashes.
Changing the color and / or opacity would be also great.

Setting: dart.closingLabels

image

Activity

  1. ghost added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Oct 22, 2021
  2. shujaatak commented on Oct 25, 2021

    @shujaatak

    Adding semantic token type for the closing labels would be highly appreciated as then it's color could be customizable by the user.

  3. DanTup commented on Oct 25, 2021

    @DanTup
    Member

    @shujaatak it's not possible to add semantic tokens here, as this text is not part of the document and not included in semantic tokens requests.

    However, there is an existing setting to control the color - see https://dartcode.org/docs/settings/#dartclosinglabels-1.

    Screenshot 2021-10-25 at 18 04 01

    @twoco does this address your need?

  4. added
    awaiting infoRequires more information from the customer to progress
    on Oct 25, 2021
  5. shujaatak commented on Oct 26, 2021

    @shujaatak

    @DanTup Thanks it helps but as @twoco said above they look confusing as one can expect them as part of the source code file just like real comments but if one open the same code in a simple text editor they don't show up.

    So, I like the @twoco idea that there should be some other identifier for them. Personally I like the "-- Container" style shown in the above @twoco comment.

  6. DanTup commented on Oct 26, 2021

    @DanTup
    Member

    https://github.com/Dart-Code/Dart-Code/blob/v3.27.2/src/extension/decorations/closing_labels_decorations.ts#L60-L69
    If this is the right code, we could replace this with a variable, a setting with a string input.

    That would work today, though the closing labels will migrate to LSP soon (once microsoft/language-server-protocol#956 is merged) so they will be controlled by the language server instead. If we decide to make changes, we should ensure the changes made will work nicely there too so the feature doesn't disappear/regress).

    Let's keep this issue open to collect 👍 s and see what the demand is like. I'm hopeful Inlay Hints will be merged soon, so if this is implemented it may make sense to do directly in the language server.

  7. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    and removed
    awaiting infoRequires more information from the customer to progress
    on Oct 26, 2021
  8. added this to the Backlog milestone on Oct 26, 2021
  9. infacto commented on Apr 25, 2022

    @infacto

    The close label indicator feature is great, but it's really annoying that it's hard to distinguish from real comments.

    My current solution is adding this to settings.json:

    {
      "workbench.colorCustomizations": {
        "dart.closingLabels": "#80808040"
      }
    }

    A less prominent appearance and different from comments. But you need a real comment as reference. Therefore it's maybe not the worst idea to use other characters to identify.

    If we add an option to customize the text, I would suggest prefix and suffix. To allow something like -- Text an (Text) etc. Or just something like "dart.closingLabelsString": "/* $1 */" But only a suffix is also great. Maybe other style can also help. Like font-size? Idk. Just separate from real comments. Or improve Dart / Flutter design making closing labels annotations unnecessary. ...

  10. gazialankus commented on Dec 22, 2023

    @gazialankus

    Like font-size? Idk.

    YES. See the inlay hints with the small font size? I would love it if I can get these closing labels to look the same. Then my eyes can group them similarly as not real code but suggestions. I really like this small font size for the inlay hints, so I'm pretty sure it will work perfectly for me if I can change the font.
    image

    For anyone wondering, here are the settings for the inlay hints:

        "[dart]": {
            "editor.inlayHints.enabled": "on",
            "editor.inlayHints.fontSize": 8,
            "editor.inlayHints.padding": false,
            "editor.inlayHints.fontFamily": "Arial", 
    
  11. modified the milestones: Backlog, v3.82.0, On Deck on Jan 3, 2024
  12. DanTup commented on Jan 3, 2024

    @DanTup
    Member

    I think it's a fair request to be able to customise these further and would accept PRs to do this. The styling is handled here:

    after: {
    color: new vs.ThemeColor("dart.closingLabels"),
    margin: "2px",
    },

    And the prefix is handled here:

    if (existingDecorationForLine) {
    existingDecorationForLine.renderOptions.after.contentText = " // " + r.label + " " + existingDecorationForLine.renderOptions.after.contentText;
    } else {
    const dec = {
    range: new vs.Range(labelRange.start, endOfLine),
    renderOptions: { after: { contentText: " // " + r.label } },
    };
    decorations[endOfLine.line] = dec;
    }

  13. added
    good first issue :octocat:A relatively straight forward issue that could be done by a new contributor
    on Jan 3, 2024
  14. changed the title [-]Allow other characters for closing labels to distinguish from comments. (//)[/-] [+]Allow customisation of closing label prefix and font/size[/+] on Jan 3, 2024
  15. modified the milestones: On Deck, v3.98.0 on Sep 13, 2024
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

    good first issue :octocat:A relatively straight forward issue that could be done by a new contributorin editorRelates to code editing or language featuresis 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