Skip to content

Enter inside a comment should start a comment on the next line. #180551

Closed

Description

image

Caret is after solution in that comment. Hitting enter should produce:

image

(note the caret location as well). But it does not. Instead, you get:

image

Activity

  1. CyrusNajmabadi commented on Apr 27, 2023

    @CyrusNajmabadi

    Alexandru Dima (@alexdima) lmk if there's any information you need from us on this.

  2. alexdima commented on Apr 28, 2023

    @alexdima
    Member

    This is a nice idea and can be achieved by adding the following rule to onEnterRules in the language configuration:

    "onEnterRules": [
        {
            "beforeText": {
                "pattern": "//.*"
            },
            "afterText": {
                "pattern": "\\S+"
            },
            "action": {
                "indent": "none",
                "appendText": "// "
            }
        },
        // ...
    ]
    Kapture.2023-04-28.at.09.28.21.mp4
  3. added
    feature-request
    on Apr 28, 2023
  4. 17 remaining items

  5. added
    insiders-released
    and removed
    unreleased
    on Nov 6, 2024
  6. RobertOstermann commented on Nov 7, 2024

    @RobertOstermann

    Aiday Marlen Kyzy (@aiday-mar) Is there a way to disable this? Most of the time I am working with comments I do not want the next line to also be commented.

    To me it makes sense to continue the comment when pressing enter while there are letters after the caret, but if the caret is at the end it should not add a // to the following line.

  7. aiday-mar commented on Nov 8, 2024

    @aiday-mar
    Collaborator

    Hi Robert Ostermann (@RobertOstermann) thanks for the comment. This behavior has changed and now it behaves as what you mentioned, that is a comment is added when there are letters after the cursor position on the current line. You should see this in the latest insiders

  8. starball5 commented on Nov 11, 2024

    @starball5

    The case with no text after caret is covered by #26694.

  9. iwangbowen commented on Nov 30, 2024

    @iwangbowen

    Why it took so long add this feature

  10. added
    verification-needed
    verified
    on Dec 4, 2024
  11. aoyama-val commented on Dec 15, 2024

    @aoyama-val

    Is there a plan to enable this also when the cursor is at the end of line?

  12. aiday-mar commented on Dec 16, 2024

    @aiday-mar
    Collaborator

    Hi aoyama-val (@aoyama-val) thank you for the comment. For the moment there is no such plan.

  13. CyrusNajmabadi commented on Dec 16, 2024

    @CyrusNajmabadi

    Bowen Wang (@iwangbowen)

    Why it took so long add this feature

    Resourcing and other priorities. Note: this is all open source. So if this is something you are passionate about, we welcome community contributions.

  14. CyrusNajmabadi commented on Dec 16, 2024

    @CyrusNajmabadi

    Hi aoyama-val (@aoyama-val) thank you for the comment. For the moment there is no such plan.

    This also matches VS behavior, which was driven on tons of feedback to have this behavior.

  15. locked and limited conversation to collaborators on Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestinsiders-releasedlanguages-basicverification-neededverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions